|
发表于 2013-4-23 09:29:15
|
显示全部楼层
来自 中国广东东莞
<?php
if(preg_match('/MSIE\s+6/',$_SERVER['HTTP_USER_AGENT'])){
header("Location: a.php");
}else{
header("Location: b.php");
}
?>
asp的
<%
Dim BrowserString
BrowserString = Request.ServerVariables("HTTP_USER_AGENT")
BrowserString = Lcase(BrowserString)
Dim broFirefox,broMSIE,broOpera,broWap
broFirefox = "firefox"
broMSIE = "msie"
broOpera = "opera"
broWap = "wap"
'如果是Firefox
if Instr(BrowserString, broFirefox) <> 0 then
Response.Redirect(broFirefox & ".asp")
end if
'如果是MSIE
if Instr(BrowserString, broMSIE) <> 0 then
Response.Redirect(broMSIE & ".asp")
end if
'如果是Opera
if Instr(BrowserString, broOpera) <> 0 then
Response.Redirect(broOpera & ".asp")
end if
'如果是Wap(没有用过所以还要看HTTP_USER_AGENT表示的结果)
if Instr(BrowserString, broWap) <> 0 then
Response.Redirect(broWap & ".asp")
end if
%>
|
|