php 函数 get_browser 的可靠性如何?
我正在尝试找到一种检测访问者操作系统、浏览器等的好方法。
我找到了 PHP 函数 get_browser
我看到该函数可以检测 Java,虽然该函数使用用户代理进行检测,但在安装了 java 的 VM ua 上我没有看到任何提及 Java 的内容。
该函数如何知道?
I am trying to find a good way to detect a visitor OS, browser, etc.
I found the PHP function get_browser
And I see that function can detect Java, I though the function used the user agent for detection, and I don't see any mention to Java on my VMs ua with java installed.
How does the function knows?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它与您的
browscap.ini
文件一样准确。该文件未与 PHP 捆绑在一起,因此您需要使其保持最新状态。您可以从 http://browsers.garykeith.com/downloads.asp 获取它。注意:数组中包含的值基于浏览器的“技术能力”,不考虑用户禁用的功能(即用户可能禁用了 JavaScript)。
It's as accurate as your
browscap.ini
file is. The file isn't bundled with PHP so it's up to you to keep it up-to-date. You can get it from http://browsers.garykeith.com/downloads.asp.Notice: The values contained in the array are based on the "technical capabilities" of the browser and do not account for features that were disabled by the user (i.e. the user may have disabled JavaScript).
这是不可靠的。它仅告诉您如果启用了该功能,浏览器可能支持什么。
更不用说,用户代理可以被欺骗。
It is not reliable. It only tells you what the browser might support if it had the feature enabled.
Not to mention, the user agent can be spoofed.