PHP: If internet explorer 6, 7, 8 , or 9(PHP:如果 Internet Explorer 6、7、8 或 9)
问题描述
我想在 PHP 中为不同版本的 Internet Explorer 执行以下操作:
I want to do a conditional in PHP for the different versions of Internet Explorer along the lines of:
if($browser == ie6){//做这个} elseif($browser == ie7) {//做这个 } elseif...
我已经看到类似代码的许多变体,但正在寻找一些非常简单的代码来执行一些简单的 if 和 else 并执行不同的操作.
I have seen many variations on similar code, but looking for something super simple that is very easy to code to do some simple if and else and do different things.
谢谢
我需要这个来向用户显示一些不同的消息,所以 CSS 条件等不好.
I need this to show some different messages to users so CSS conditionals etc are no good.
推荐答案
这是我最终使用的一个变体,它检查 IE8 及以下:
This is what I ended up using a variation of, which checks for IE8 and below:
if (preg_match('/MSIEs(?P<v>d+)/i', @$_SERVER['HTTP_USER_AGENT'], $B) && $B['v'] <= 8) {
// Browsers IE 8 and below
} else {
// All other browsers
}
这篇关于PHP:如果 Internet Explorer 6、7、8 或 9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PHP:如果 Internet Explorer 6、7、8 或 9


基础教程推荐
- 在多维数组中查找最大值 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01