4

如何使用php检查浏览器是否为IE8或更低?

4

4 回答 4

9
if(preg_match('/(?i)msie [2-8]/',$_SERVER['HTTP_USER_AGENT']))
于 2013-05-31T15:52:58.433 回答
4

编辑

<?php
//echo $_SERVER['HTTP_USER_AGENT'] . "\n\n";

$browser = get_browser(null, true);
echo "<pre>";
print_r($browser['version']);
?>

检查屏幕截图

于 2012-07-17T04:56:44.600 回答
1

试试这个链接

典型用法。

$browser = new Browser();
if( $browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) {
    echo 'You have FireFox version 2 or greater';
}
于 2012-07-17T04:59:05.993 回答
-5
    $(document).ready(function(){ 
    var bro=$.browser; 
    var binfo=""; 
    if(bro.msie) {binfo="Microsoft Internet Explorer "+bro.version;} 
    if(bro.mozilla) {binfo="Mozilla Firefox "+bro.version;} 
    if(bro.safari) {binfo="Apple Safari "+bro.version;} 
    if(bro.opera) {binfo="Opera "+bro.version;} 
    alert(binfo); 
    $("#browser").html(binfo); 
}) 
于 2012-07-17T06:06:07.287 回答