如何使用PHP将IE用户重定向到某个页面? [英] How can I use PHP to redirect IE users to a certain page?
本文介绍了如何使用PHP将IE用户重定向到某个页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用我的网站版本,可以在Internet Explorer中正确呈现; PHP脚本会自动将使用IE用户代理的用户重定向到(例如)/index-ie.php,看起来像什么?
I'm working on a version of my website which renders properly in Internet Explorer; what would a PHP script, which automatically redirects users with an IE user agent to (for example) /index-ie.php, look like?
推荐答案
尝试
PHP有功能 $ _ SERVER ['HTTP_USER_AGENT'] 用于识别浏览器
PHP have function $_SERVER['HTTP_USER_AGENT'] used to identify browser
if(using_ie())
{
//redirect
}
function using_ie()
{
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$ub = False;
if(preg_match('/MSIE/i',$u_agent))
{
$ub = True;
}
return $ub;
}
这篇关于如何使用PHP将IE用户重定向到某个页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文