PHP get_browser:如何识别 ie7 和 ie6?
有没有办法使用 PHP 的 get_browser() 函数来区分 IE7 和 IE6?
Is there any way to differentiate IE7 versus IE6 using PHP's get_browser() function?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我读到 get_browser() 是一个相对较慢的函数,所以我正在寻找更快的函数。 此代码检查 MSIE 7.0,输出“Otay!” 如果属实。 与上一篇文章的答案基本相同,只是更简洁。 相当简单的 if 语句:
I read that get_browser() is a relatively slow function, so I was looking for something speedier. This code checks for MSIE 7.0, outputting "Otay!" if true. It's basically the same answer as the previous post, just more concise. Fairly straightforward if statement:
以下是取自此处的完整示例。
Below is a complete example taken from here.
如果您的逻辑是决定要包含哪些样式表或脚本,那么可能值得采用条件注释的 HTML 路线:
这样您就可以绕过任何自定义浏览器字符串等。 更多信息请访问 QuirksMode。
If your logic is to decide what stylesheets or scripts to include, it maybe worth going the HTML route of conditional comments:
That way you get around any custom browser strings and the like. More info at QuirksMode.
我发现了一个不同的、非常简单的 PHP IE6 条件解决方案,我可以根据自己的目的进行编辑:
完整的脚本可以在这里找到:
http://www.thatgrafix.com/php_detect/
I found a different, really simple solution for a PHP IE6 conditional that I was able to edit for my own purposes:
The full script can be found here:
http://www.thatgrafix.com/php_detect/
您可以这样做:
快速查看官方
get_browser ()
文档会回答您的问题。 务必先阅读文档。You can do so as such:
A quick look to the official
get_browser()
documentation would of answered your question. Always read the documentation before.