PHP:如果Internet Explorer 6,7,8或9 [英] PHP: If internet explorer 6, 7, 8 , or 9

查看:163
本文介绍了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:

如果($浏览器IE6 ==){//做} ELSEIF($浏览器IE7 ==){// dothis} ELSEIF ...

我看到的类似code许多变化,但寻找一些超级简单,这是非常容易code做一些简单的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.

推荐答案

这是我最后使用的变化,这将检查IE 5-8:

This is what I ended up using a variation of, which checks for IE 5-8:

if(preg_match('/(?i)msie [5-8]/',$_SERVER['HTTP_USER_AGENT']))
{
    // if IE<=8
    include ( TEMPLATEPATH . '/noie.php' );
    exit;
}
else
{
    // if IE>8
}

这篇关于PHP:如果Internet Explorer 6,7,8或9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆