在PHP中使用get_browser函数时:
我刚刚下载了最新的browscap.in文件。
我的user_agent是:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
WAMP:
Array
(
[browser_name_regex] => §^.*$§
[browser_name_pattern] => *
[browser] => Default Browser
[version] => 0
[majorver] => 0
[minorver] => 0
[platform] => unknown
[alpha] =>
[beta] =>
[win16] =>
[win32] =>
[win64] =>
[frames] =>
[iframes] =>
[tables] =>
[cookies] =>
[backgroundsounds] =>
[javascript] =>
[vbscript] =>
[javaapplets] =>
[activexcontrols] =>
[isbanned] =>
[ismobiledevice] =>
[issyndicationreader] =>
[crawler] =>
[cssversion] => 0
[aolversion] => 0
)
服务器:
Array
(
[browser_name_regex] => �^mozilla/5\.0 \(.*windows nt 6\.1.*wow64.*rv:.*\) gecko/.* firefox/9\..*$�
[browser_name_pattern] => Mozilla/5.0 (*Windows NT 6.1*WOW64*rv:*) Gecko/* Firefox/9.*
[parent] => Firefox 9.0
[platform] => Win7
[win32] =>
[win64] => 1
[browser] => Firefox
[version] => 9.0
[majorver] => 9
[frames] => 1
[iframes] => 1
[tables] => 1
[cookies] => 1
[javascript] => 1
[javaapplets] => 1
[cssversion] => 3
[minorver] => 0
[alpha] =>
[beta] =>
[win16] =>
[backgroundsounds] =>
[vbscript] =>
[activexcontrols] =>
[isbanned] =>
[ismobiledevice] =>
[issyndicationreader] =>
[crawler] =>
[aolversion] => 0
)
问题:我如何解决WAMP中的这个问题,以便它像linux服务器一样行为?
答案 0 :(得分:1)
似乎您的php.ini
文件未包含browscap
ini文件的路径。
看看是否存在此设置:
[browscap]
browscap = /path/to/your/php_browscap.ini
答案 1 :(得分:1)
我建议使用这个“php的原生get_browser()函数的独立替换” https://github.com/garetjax/phpbrowscap
中使用此库以下是功能列表: