最近,我开始在PHP内部使用get_browser()函数,并遇到了一个重大问题。我试图将用户正在使用的浏览器返回给用户,但当我运行代码时:
$browser = get_browser(null, true);
print($browser['browser']);它返回'DefaultBrowser‘。我更新了我的Browscap.ini文件,并指定了php.ini文件中的位置,但是它似乎没有任何改变。任何解决方案,我是非常新的PHP。谢谢
发布于 2013-12-06 16:33:43
不幸的是,browscap.ini文件没有浏览器那么频繁地更新(这是非常频繁的,现在)。幸运的是,您可以自己编辑文件并复制粘贴在其中的最新浏览器,然后增加版本号。通常情况下,功能是相同或更好的,所以它不应该引起问题。
编辑
browscap.ini文件包含的条目如下
[IE 10.0]
Parent=DefaultProperties
Comment="IE 10.0"
Browser="IE"
Version=10.0
MajorVer=10
MinorVer=0
Beta=true
Win32=true
Frames=true
IFrames=true
Tables=true
Cookies=true
BackgroundSounds=true
JavaScript=true
VBScript=true
JavaApplets=true
ActiveXControls=true
CssVersion=3
[Mozilla/*(*MSIE 10.*Windows NT 6.1*64*Trident/6.0*)*]
Parent=IE 10.0
Platform="Win7"
Platform_Version=6.1
Win32=false
Win64=true一个版本的一般条目,加上一些特定平台的条目。您只需复制这些文件,将版本从10更改为11,然后将它们添加到文件中。
所以这两个条目
[IE 11.0]
Parent=DefaultProperties
Comment="IE 11.0"
Browser="IE"
Version=11.0
MajorVer=11
MinorVer=0
Beta=true
Win32=true
Frames=true
IFrames=true
Tables=true
Cookies=true
BackgroundSounds=true
JavaScript=true
VBScript=true
JavaApplets=true
ActiveXControls=true
CssVersion=3
[Mozilla/*(*MSIE 11.*Windows NT 6.1*64*Trident/6.0*)*]
Parent=IE 11.0
Platform="Win7"
Platform_Version=6.1
Win32=false
Win64=truehttps://stackoverflow.com/questions/20409856
复制相似问题