PHP页面跳转问题,判断浏览器版本

2025-03-10 14:02:50
推荐回答(2个)
回答1:

$agent = $_SERVER["HTTP_USER_AGENT"];
if(strpos($agent,"MSIE 8.0")||strpos($agent,"MSIE 7.0")||strpos($agent,"MSIE 6.0")){
    header("location:a.php");
}else{
    header("location:b.php");
}

回答2:

if(preg_match('/MSIE\s+6/',$_SERVER['HTTP_USER_AGENT'])){
header("Location: a.php");
}else{
header("Location: b.php");
}
?>