我正在为一个小网站工作,在那里我被要求在php脚本的帮助下获取当时正在使用该网站的客户端的浏览器名称。
任何想法怎么做?
答案 0 :(得分:0)
检查broswer Information。有一个function getBrowser()
答案 1 :(得分:0)
<强>代码强>:
<?php
echo $_SERVER['HTTP_USER_AGENT'];
?>
<强>输出强>:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3
<强>代码强>:
$browser = get_browser(null, true);
print_r($browser);
<强>输出强>:
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] =>
)