手机wap,wap2(xhtml),电脑自适应进入对应页
http://bbs.blueidea.com/thread-2917206-1-1.html
php版的.
<?php
$htm = "http://www.rolandlau.com/index.html";
$wap = "http://wap.rolandlau.com/index.wml";
$wap2 = "http://www.rolandlau.com/index.htm";
$agent=$_SERVER['HTTP_USER_AGENT'];
$Accept = $_SERVER["HTTP_ACCEPT"];
echo $agent;
$isWAP = false;
if (substr_count(strtolower($Accept),strtolower("wap")) || substr_count(strtolower($Accept),strtolower("wml"))) {
$isWAP = true;
}else{
$brow = substr($agent,0,4);
if (strtolower($brow)==strtolower("Noki") || strtolower($brow)==strtolower("Eric") || strtolower($brow)==strtolower("R380") || strtolower($brow)==strtolower("MOT-") || strtolower($brow)==strtolower("UPG1") || strtolower($brow)==strtolower("Jing") || strtolower($brow)==strtolower("Acoo") || strtolower($brow)==strtolower("Wapt") || strtolower($brow)==strtolower("QWAP") || strtolower($brow)==strtolower("m-cr") || strtolower($brow)==strtolower("MC21") || strtolower($brow)==strtolower("Your") || strtolower($brow)==strtolower("YOUR") || strtolower($brow)==strtolower("w@pS") || strtolower($brow)==strtolower("Alca") || strtolower($brow)==strtolower("wapw") || strtolower($brow)==strtolower("Rain") || strtolower($brow)==strtolower("Java") || strtolower($brow)==strtolower("AUR ") || strtolower($brow)==strtolower("UP.B") || strtolower($brow)==strtolower("WAPm") || strtolower($brow)==strtolower("WinW") || strtolower($brow)==strtolower("WapI") || strtolower($brow)==strtolower("WAPJ") || strtolower($brow)==strtolower("WapV") || strtolower($brow)==strtolower("4thp") || strtolower($brow)==strtolower("Waps") || strtolower($brow)==strtolower("Mits") || strtolower($brow)==strtolower("SIE-") || strtolower($brow)==strtolower("Aptu") || strtolower($brow)==strtolower("WmlS") || strtolower($brow)==strtolower("Wapa")) {
$isWAP = true;
}}
$isWAP2 = false;
if ($isWAP) {
if (substr_count(strtolower($Accept),strtolower("xhtml"))) {
$isWAP2 = true;
}}
if ($isWAP2) {
header("location:$wap2");}
else if ($isWAP) {
header("location:$wap");}
else {
header("location:$htm");
}
?>
<p>本页没有跳转,请手工选择您的线路</p>
<a href="http://wap.rolandlau.com/index.wml">低端手机wap</a><a href="http://www.rolandlau.com/index.htm">高端手机xhtml</a><a href="http://www.rolandlau.com/index.html">电脑访问</a>
近期评论