운영 체제 정보 가져오기
최근 사용자의 운영체제 정보를 얻을 수 있는 http://thismachine.info/과 같은 사이트에 대해 궁금해하기 시작했습니다.PHP로 그것을 하는 방법을 찾지 못하고 있기 때문에, 그것을 생각해 보고 싶다고 생각하고 있습니다.
으로 되어 있다는 .user-agent
브라우저에 대한 많은 정보를 제공합니다.운영체제 정보는 그것으로부터 얻습니까, 아니면 다른 것으로부터 얻습니까?사용자의 운영체제를 입수하기 위해 사용할 수 있는 API가 있나요?
브라우저와 IP는 어떻게 얻었지만 운영체제 부분은 알 수 없었습니다!
아래 코드는 http://thismachine.info/가 어떤 운영체제를 사용하고 있는지 그 자체로 설명할 수 있습니다.
예를 들어 핵심 운영체제 모델을 스니핑합니다.windows nt 5.1
내 것으로서.
그런 다음 Windows NT 5.1/i를 운영체제로서 Windows XP에 전달합니다.
'/windows nt 5.1/i' => 'Windows XP',
배열로부터.
추측이라고 할 수도 있고, 근사라고 할 수도 있지만, 그럼에도 불구하고 거의 그대로입니다.
SO https://stackoverflow.com/a/15497878/의 답변에서 차용
<?php
$user_agent = $_SERVER['HTTP_USER_AGENT'];
function getOS() {
global $user_agent;
$os_platform = "Unknown OS Platform";
$os_array = array(
'/windows nt 10/i' => 'Windows 10',
'/windows nt 6.3/i' => 'Windows 8.1',
'/windows nt 6.2/i' => 'Windows 8',
'/windows nt 6.1/i' => 'Windows 7',
'/windows nt 6.0/i' => 'Windows Vista',
'/windows nt 5.2/i' => 'Windows Server 2003/XP x64',
'/windows nt 5.1/i' => 'Windows XP',
'/windows xp/i' => 'Windows XP',
'/windows nt 5.0/i' => 'Windows 2000',
'/windows me/i' => 'Windows ME',
'/win98/i' => 'Windows 98',
'/win95/i' => 'Windows 95',
'/win16/i' => 'Windows 3.11',
'/macintosh|mac os x/i' => 'Mac OS X',
'/mac_powerpc/i' => 'Mac OS 9',
'/linux/i' => 'Linux',
'/ubuntu/i' => 'Ubuntu',
'/iphone/i' => 'iPhone',
'/ipod/i' => 'iPod',
'/ipad/i' => 'iPad',
'/android/i' => 'Android',
'/blackberry/i' => 'BlackBerry',
'/webos/i' => 'Mobile'
);
foreach ($os_array as $regex => $value)
if (preg_match($regex, $user_agent))
$os_platform = $value;
return $os_platform;
}
function getBrowser() {
global $user_agent;
$browser = "Unknown Browser";
$browser_array = array(
'/msie/i' => 'Internet Explorer',
'/firefox/i' => 'Firefox',
'/safari/i' => 'Safari',
'/chrome/i' => 'Chrome',
'/edge/i' => 'Edge',
'/opera/i' => 'Opera',
'/netscape/i' => 'Netscape',
'/maxthon/i' => 'Maxthon',
'/konqueror/i' => 'Konqueror',
'/mobile/i' => 'Handheld Browser'
);
foreach ($browser_array as $regex => $value)
if (preg_match($regex, $user_agent))
$browser = $value;
return $browser;
}
$user_os = getOS();
$user_browser = getBrowser();
$device_details = "<strong>Browser: </strong>".$user_browser."<br /><strong>Operating System: </strong>".$user_os."";
print_r($device_details);
echo("<br /><br /><br />".$_SERVER['HTTP_USER_AGENT']."");
?>
각주 : (1월 19일/14일)2014년 1월 18일 추가 권장 편집이 있었습니다./msie|trident/i
YJSoft가 SO의 새로운 멤버로 등장했습니다.
코멘트는 다음과 같습니다.
코멘트: msie11의 ua에는 msie가 포함되어 있지 않기 때문에(대신 trident가 포함되어 있습니다)
나는 이것을 잠시 조사했고, 트라이던트 줄을 설명하는 몇 가지 링크를 발견했다.
- http://www.sitepoint.com/ie11-smells-like-firefox/
- http://www.upsdell.ca/BrowserNews/res_sniff.htm
- JavaScript를 사용하는 Internet Explorer 11만을 대상으로 하는 방법은 무엇입니까?
- http://en.wikipedia.org/wiki/Trident_%28layout_engine%29
- https://stackoverflow.com/a/17907562/1415724
- http://msdn.microsoft.com/en-us/library/ie/bg182625(v=vs.110).aspx
- MSDN 블로그 기사
- NCZOnline 관련 기사
비록 편집이 거부되었지만(나 자신이 아니라 다른 편집자 중 일부에 의해), 위의 링크를 읽고 올바른 판단을 내리는 것이 좋습니다.
SUSE 검출에 관한 질문에 대해서는, 다음의 URL 로 이 코드를 확인할 수 있습니다.
추가 코드:
/* return Operating System */
function operating_system_detection(){
if ( isset( $_SERVER ) ) {
$agent = $_SERVER['HTTP_USER_AGENT'];
}
else {
global $HTTP_SERVER_VARS;
if ( isset( $HTTP_SERVER_VARS ) ) {
$agent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
}
else {
global $HTTP_USER_AGENT;
$agent = $HTTP_USER_AGENT;
}
}
$ros[] = array('Windows XP', 'Windows XP');
$ros[] = array('Windows NT 5.1|Windows NT5.1)', 'Windows XP');
$ros[] = array('Windows 2000', 'Windows 2000');
$ros[] = array('Windows NT 5.0', 'Windows 2000');
$ros[] = array('Windows NT 4.0|WinNT4.0', 'Windows NT');
$ros[] = array('Windows NT 5.2', 'Windows Server 2003');
$ros[] = array('Windows NT 6.0', 'Windows Vista');
$ros[] = array('Windows NT 7.0', 'Windows 7');
$ros[] = array('Windows CE', 'Windows CE');
$ros[] = array('(media center pc).([0-9]{1,2}\.[0-9]{1,2})', 'Windows Media Center');
$ros[] = array('(win)([0-9]{1,2}\.[0-9x]{1,2})', 'Windows');
$ros[] = array('(win)([0-9]{2})', 'Windows');
$ros[] = array('(windows)([0-9x]{2})', 'Windows');
// Doesn't seem like these are necessary...not totally sure though..
//$ros[] = array('(winnt)([0-9]{1,2}\.[0-9]{1,2}){0,1}', 'Windows NT');
//$ros[] = array('(windows nt)(([0-9]{1,2}\.[0-9]{1,2}){0,1})', 'Windows NT'); // fix by bg
$ros[] = array('Windows ME', 'Windows ME');
$ros[] = array('Win 9x 4.90', 'Windows ME');
$ros[] = array('Windows 98|Win98', 'Windows 98');
$ros[] = array('Windows 95', 'Windows 95');
$ros[] = array('(windows)([0-9]{1,2}\.[0-9]{1,2})', 'Windows');
$ros[] = array('win32', 'Windows');
$ros[] = array('(java)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})', 'Java');
$ros[] = array('(Solaris)([0-9]{1,2}\.[0-9x]{1,2}){0,1}', 'Solaris');
$ros[] = array('dos x86', 'DOS');
$ros[] = array('unix', 'Unix');
$ros[] = array('Mac OS X', 'Mac OS X');
$ros[] = array('Mac_PowerPC', 'Macintosh PowerPC');
$ros[] = array('(mac|Macintosh)', 'Mac OS');
$ros[] = array('(sunos)([0-9]{1,2}\.[0-9]{1,2}){0,1}', 'SunOS');
$ros[] = array('(beos)([0-9]{1,2}\.[0-9]{1,2}){0,1}', 'BeOS');
$ros[] = array('(risc os)([0-9]{1,2}\.[0-9]{1,2})', 'RISC OS');
$ros[] = array('os/2', 'OS/2');
$ros[] = array('freebsd', 'FreeBSD');
$ros[] = array('openbsd', 'OpenBSD');
$ros[] = array('netbsd', 'NetBSD');
$ros[] = array('irix', 'IRIX');
$ros[] = array('plan9', 'Plan9');
$ros[] = array('osf', 'OSF');
$ros[] = array('aix', 'AIX');
$ros[] = array('GNU Hurd', 'GNU Hurd');
$ros[] = array('(fedora)', 'Linux - Fedora');
$ros[] = array('(kubuntu)', 'Linux - Kubuntu');
$ros[] = array('(ubuntu)', 'Linux - Ubuntu');
$ros[] = array('(debian)', 'Linux - Debian');
$ros[] = array('(CentOS)', 'Linux - CentOS');
$ros[] = array('(Mandriva).([0-9]{1,3}(\.[0-9]{1,3})?(\.[0-9]{1,3})?)', 'Linux - Mandriva');
$ros[] = array('(SUSE).([0-9]{1,3}(\.[0-9]{1,3})?(\.[0-9]{1,3})?)', 'Linux - SUSE');
$ros[] = array('(Dropline)', 'Linux - Slackware (Dropline GNOME)');
$ros[] = array('(ASPLinux)', 'Linux - ASPLinux');
$ros[] = array('(Red Hat)', 'Linux - Red Hat');
// Loads of Linux machines will be detected as unix.
// Actually, all of the linux machines I've checked have the 'X11' in the User Agent.
//$ros[] = array('X11', 'Unix');
$ros[] = array('(linux)', 'Linux');
$ros[] = array('(amigaos)([0-9]{1,2}\.[0-9]{1,2})', 'AmigaOS');
$ros[] = array('amiga-aweb', 'AmigaOS');
$ros[] = array('amiga', 'Amiga');
$ros[] = array('AvantGo', 'PalmOS');
//$ros[] = array('(Linux)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}(rel\.[0-9]{1,2}){0,1}-([0-9]{1,2}) i([0-9]{1})86){1}', 'Linux');
//$ros[] = array('(Linux)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}(rel\.[0-9]{1,2}){0,1} i([0-9]{1}86)){1}', 'Linux');
//$ros[] = array('(Linux)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}(rel\.[0-9]{1,2}){0,1})', 'Linux');
$ros[] = array('[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}', 'Linux');
$ros[] = array('(webtv)/([0-9]{1,2}\.[0-9]{1,2})', 'WebTV');
$ros[] = array('Dreamcast', 'Dreamcast OS');
$ros[] = array('GetRight', 'Windows');
$ros[] = array('go!zilla', 'Windows');
$ros[] = array('gozilla', 'Windows');
$ros[] = array('gulliver', 'Windows');
$ros[] = array('ia archiver', 'Windows');
$ros[] = array('NetPositive', 'Windows');
$ros[] = array('mass downloader', 'Windows');
$ros[] = array('microsoft', 'Windows');
$ros[] = array('offline explorer', 'Windows');
$ros[] = array('teleport', 'Windows');
$ros[] = array('web downloader', 'Windows');
$ros[] = array('webcapture', 'Windows');
$ros[] = array('webcollage', 'Windows');
$ros[] = array('webcopier', 'Windows');
$ros[] = array('webstripper', 'Windows');
$ros[] = array('webzip', 'Windows');
$ros[] = array('wget', 'Windows');
$ros[] = array('Java', 'Unknown');
$ros[] = array('flashget', 'Windows');
// delete next line if the script show not the right OS
//$ros[] = array('(PHP)/([0-9]{1,2}.[0-9]{1,2})', 'PHP');
$ros[] = array('MS FrontPage', 'Windows');
$ros[] = array('(msproxy)/([0-9]{1,2}.[0-9]{1,2})', 'Windows');
$ros[] = array('(msie)([0-9]{1,2}.[0-9]{1,2})', 'Windows');
$ros[] = array('libwww-perl', 'Unix');
$ros[] = array('UP.Browser', 'Windows CE');
$ros[] = array('NetAnts', 'Windows');
$file = count ( $ros );
$os = '';
for ( $n=0 ; $n<$file ; $n++ ){
if ( preg_match('/'.$ros[$n][0].'/i' , $agent, $name)){
$os = @$ros[$n][1].' '.@$name[2];
break;
}
}
return trim ( $os );
}
편집 : 2015년 4월 12일
저는 어제 이 Q&A와 관련이 있을 수 있고 도움이 될 수 있는 질문을 발견했습니다.다음에 대해서:
Mozilla/5.0 (Linux; Android 4.4.2; SAMSUNG-GT-I9505 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36
- 질문:.PHP를 사용하여 regex를 사용하여 다른 변수의 변수에 특정 데이터 저장
- 답변: https://stackoverflow.com/a/29584014/
다른 편집 및 요청(및 오늘 11월 4일 오늘 답변/승인됨)된 참조 링크 추가가 도움이 될 수 있습니다.
스택에 관한 Q&A를 참조해 주세요.
웹 사이트에 가면 브라우저가 웹 서버에 많은 정보를 포함한 요청을 보냅니다.이 정보는 다음과 같습니다.
GET /questions/18070154/get-operating-system-info-with-php HTTP/1.1
Host: stackoverflow.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate,sdch
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: <cookie data removed>
Pragma: no-cache
Cache-Control: no-cache
이러한 정보는 모두 웹 서버에서 요청 처리 방법, 기본 언어 및 압축 허용 여부를 결정하기 위해 사용됩니다.
에서는 이 모든 가 PHP에 됩니다.$_SERVER
웹 서버에 보내는 내용을 보려면 새 PHP 파일을 만들고 배열에서 모든 내용을 인쇄하십시오.
<pre><?php print_r($_SERVER); ?></pre>
모든 할 수 서, 「」, 「」할 수 .여기서 원하는 정보를 추출할 수 있습니다.$_SERVER['HTTP_USER_AGENT']
과 browseroperating system을 합니다.
get_browser에 대해 php 매뉴얼에서 다음 코드를 가져왔습니다.
$browser = get_browser(null, true);
print_r($browser);
$browser
에 ''가 있습니다.platform
사용 중인 특정 운영체제에 대한 정보가 포함되어 있습니다.
해당 페이지의 "메모" 섹션을 참조하십시오.이것은 (thismachine.info)가 사용하고 있는 것일 수 있습니다.다른 답변에서 이미 지적된 내용이 아닌 경우입니다.
Fred-II의 답변에 따르면 getOS 기능에 대한 저의 견해를 공유하고 싶습니다.global을 회피하고 양쪽 목록을 Marge하여 아키텍처를 검출합니다(x32/x64).
/**
* @param $user_agent null
* @return string
*/
function getOS($user_agent = null)
{
if(!isset($user_agent) && isset($_SERVER['HTTP_USER_AGENT'])) {
$user_agent = $_SERVER['HTTP_USER_AGENT'];
}
// https://stackoverflow.com/questions/18070154/get-operating-system-info-with-php
$os_array = [
'windows nt 10' => 'Windows 10',
'windows nt 6.3' => 'Windows 8.1',
'windows nt 6.2' => 'Windows 8',
'windows nt 6.1|windows nt 7.0' => 'Windows 7',
'windows nt 6.0' => 'Windows Vista',
'windows nt 5.2' => 'Windows Server 2003/XP x64',
'windows nt 5.1' => 'Windows XP',
'windows xp' => 'Windows XP',
'windows nt 5.0|windows nt5.1|windows 2000' => 'Windows 2000',
'windows me' => 'Windows ME',
'windows nt 4.0|winnt4.0' => 'Windows NT',
'windows ce' => 'Windows CE',
'windows 98|win98' => 'Windows 98',
'windows 95|win95' => 'Windows 95',
'win16' => 'Windows 3.11',
'mac os x 10.1[^0-9]' => 'Mac OS X Puma',
'macintosh|mac os x' => 'Mac OS X',
'mac_powerpc' => 'Mac OS 9',
'ubuntu' => 'Linux - Ubuntu',
'iphone' => 'iPhone',
'ipod' => 'iPod',
'ipad' => 'iPad',
'android' => 'Android',
'blackberry' => 'BlackBerry',
'webos' => 'Mobile',
'linux' => 'Linux',
'(media center pc).([0-9]{1,2}\.[0-9]{1,2})'=>'Windows Media Center',
'(win)([0-9]{1,2}\.[0-9x]{1,2})'=>'Windows',
'(win)([0-9]{2})'=>'Windows',
'(windows)([0-9x]{2})'=>'Windows',
// Doesn't seem like these are necessary...not totally sure though..
//'(winnt)([0-9]{1,2}\.[0-9]{1,2}){0,1}'=>'Windows NT',
//'(windows nt)(([0-9]{1,2}\.[0-9]{1,2}){0,1})'=>'Windows NT', // fix by bg
'Win 9x 4.90'=>'Windows ME',
'(windows)([0-9]{1,2}\.[0-9]{1,2})'=>'Windows',
'win32'=>'Windows',
'(java)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})'=>'Java',
'(Solaris)([0-9]{1,2}\.[0-9x]{1,2}){0,1}'=>'Solaris',
'dos x86'=>'DOS',
'Mac OS X'=>'Mac OS X',
'Mac_PowerPC'=>'Macintosh PowerPC',
'(mac|Macintosh)'=>'Mac OS',
'(sunos)([0-9]{1,2}\.[0-9]{1,2}){0,1}'=>'SunOS',
'(beos)([0-9]{1,2}\.[0-9]{1,2}){0,1}'=>'BeOS',
'(risc os)([0-9]{1,2}\.[0-9]{1,2})'=>'RISC OS',
'unix'=>'Unix',
'os/2'=>'OS/2',
'freebsd'=>'FreeBSD',
'openbsd'=>'OpenBSD',
'netbsd'=>'NetBSD',
'irix'=>'IRIX',
'plan9'=>'Plan9',
'osf'=>'OSF',
'aix'=>'AIX',
'GNU Hurd'=>'GNU Hurd',
'(fedora)'=>'Linux - Fedora',
'(kubuntu)'=>'Linux - Kubuntu',
'(ubuntu)'=>'Linux - Ubuntu',
'(debian)'=>'Linux - Debian',
'(CentOS)'=>'Linux - CentOS',
'(Mandriva).([0-9]{1,3}(\.[0-9]{1,3})?(\.[0-9]{1,3})?)'=>'Linux - Mandriva',
'(SUSE).([0-9]{1,3}(\.[0-9]{1,3})?(\.[0-9]{1,3})?)'=>'Linux - SUSE',
'(Dropline)'=>'Linux - Slackware (Dropline GNOME)',
'(ASPLinux)'=>'Linux - ASPLinux',
'(Red Hat)'=>'Linux - Red Hat',
// Loads of Linux machines will be detected as unix.
// Actually, all of the linux machines I've checked have the 'X11' in the User Agent.
//'X11'=>'Unix',
'(linux)'=>'Linux',
'(amigaos)([0-9]{1,2}\.[0-9]{1,2})'=>'AmigaOS',
'amiga-aweb'=>'AmigaOS',
'amiga'=>'Amiga',
'AvantGo'=>'PalmOS',
//'(Linux)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}(rel\.[0-9]{1,2}){0,1}-([0-9]{1,2}) i([0-9]{1})86){1}'=>'Linux',
//'(Linux)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}(rel\.[0-9]{1,2}){0,1} i([0-9]{1}86)){1}'=>'Linux',
//'(Linux)([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}(rel\.[0-9]{1,2}){0,1})'=>'Linux',
'[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}'=>'Linux',
'(webtv)/([0-9]{1,2}\.[0-9]{1,2})'=>'WebTV',
'Dreamcast'=>'Dreamcast OS',
'GetRight'=>'Windows',
'go!zilla'=>'Windows',
'gozilla'=>'Windows',
'gulliver'=>'Windows',
'ia archiver'=>'Windows',
'NetPositive'=>'Windows',
'mass downloader'=>'Windows',
'microsoft'=>'Windows',
'offline explorer'=>'Windows',
'teleport'=>'Windows',
'web downloader'=>'Windows',
'webcapture'=>'Windows',
'webcollage'=>'Windows',
'webcopier'=>'Windows',
'webstripper'=>'Windows',
'webzip'=>'Windows',
'wget'=>'Windows',
'Java'=>'Unknown',
'flashget'=>'Windows',
// delete next line if the script show not the right OS
//'(PHP)/([0-9]{1,2}.[0-9]{1,2})'=>'PHP',
'MS FrontPage'=>'Windows',
'(msproxy)/([0-9]{1,2}.[0-9]{1,2})'=>'Windows',
'(msie)([0-9]{1,2}.[0-9]{1,2})'=>'Windows',
'libwww-perl'=>'Unix',
'UP.Browser'=>'Windows CE',
'NetAnts'=>'Windows',
];
// https://github.com/ahmad-sa3d/php-useragent/blob/master/core/user_agent.php
$arch_regex = '/\b(x86_64|x86-64|Win64|WOW64|x64|ia64|amd64|ppc64|sparc64|IRIX64)\b/ix';
$arch = preg_match($arch_regex, $user_agent) ? '64' : '32';
foreach ($os_array as $regex => $value) {
if (preg_match('{\b('.$regex.')\b}i', $user_agent)) {
return $value.' x'.$arch;
}
}
return 'Unknown';
}
이러한 정보를 모두 입수하려면 , 다음의 정보를 참조해 주세요.
http://php.net/manual/en/function.get-browser.phphttpphp.net/manual/en/function..php
샘플 코드를 실행하면 어떻게 작동하는지 확인할 수 있습니다.
<?php
echo $_SERVER['HTTP_USER_AGENT'] . "\n\n";
$browser = get_browser(null, true);
print_r($browser);
?>
위의 예에서는 다음과 같은 출력이 이루어집니다.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3
Array
(
[browser_name_regex] => ^mozilla/5\.0 (windows; .; windows nt 5\.1; .*rv:.*) gecko/.* firefox/0\.9.*$
[browser_name_pattern] => Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:*) Gecko/* Firefox/0.9*
[parent] => Firefox 0.9
[platform] => WinXP
[browser] => Firefox
[version] => 0.9
[majorver] => 0
[minorver] => 9
[cssversion] => 2
[frames] => 1
[iframes] => 1
[tables] => 1
[cookies] => 1
[backgroundsounds] =>
[vbscript] =>
[javascript] => 1
[javaapplets] => 1
[activexcontrols] =>
[cdf] =>
[aol] =>
[beta] => 1
[win16] =>
[crawler] =>
[stripper] =>
[wap] =>
[netclr] =>
)
예를 들어 일반적인 브라우저의 html 클래스와 같이 매우 적은 정보를 원하는 경우 다음을 사용할 수 있습니다.
function get_browser()
{
$browser = '';
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
if (preg_match('~(?:msie ?|trident.+?; ?rv: ?)(\d+)~', $ua, $matches)) $browser = 'ie ie'.$matches[1];
elseif (preg_match('~(safari|chrome|firefox)~', $ua, $matches)) $browser = $matches[1];
return $browser;
}
'e8', 'ie9', 'ie10', 'ie11'이 반환됩니다.
은 '아까부터'에서 할 수 .$_SERVER['HTTP_USER_AGENT']
그러나 이 포맷은 자유 형식이며 전송이 보장되지 않으며 프라이버시 또는 기타 이유로 사용자에 의해 쉽게 변경될 수 있습니다.
를 설정하지 않은 경우browsecap
directive. 경고가 반환됩니다.이 값이 설정되어 있는지 확인하려면 다음 명령을 사용하여 값을 검색할 수 있습니다.ini_get
세팅이 됐는지 봐주세요.
if(ini_get("browscap")) {
$browser = get_browser(null, true);
$browser = get_browser($_SERVER['HTTP_USER_AGENT']);
}
kba가 그의 답변에서 설명한 바와 같이, 당신의 브라우저는 웹 페이지를 로드하는 동안 많은 정보를 서버로 보냅니다.대부분의 웹 사이트는 이러한 사용자 에이전트 정보를 사용하여 방문자의 운영 체제, 브라우저 및 다양한 정보를 확인합니다.
Active Directory 도메인 컨트롤러가 있는 LAN(Local Area Network)에 있는 경우 shell_exec() 메서드를 사용하여 다음과 같은 명령을 실행할 수 있습니다.
wmic /node:192.168.1.3 computersystem get /format:List
시스템 정보를 취득하여 결과를 처리하다
언급URL : https://stackoverflow.com/questions/18070154/get-operating-system-info
'itsource' 카테고리의 다른 글
PHP - php 파일 포함 및 쿼리 매개 변수 전송 (0) | 2022.10.25 |
---|---|
ContextLoaderListener는? (0) | 2022.10.25 |
Python 스레드화에 join()을 사용하는 이유는 무엇입니까? (0) | 2022.10.25 |
PHP 버전을 PHPStorm으로 설정하려면 어떻게 해야 하나요? (0) | 2022.10.25 |
JavaScript에서 어레이를 비교하는 방법 (0) | 2022.10.25 |