私人领地

判断网页 手机版入口

代码

$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
$uachar = "/(nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|mobile)/i";
if(($ua == '' || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']),'wap'))
{
    echo "<script type='text/javascript'>location.href='app/'</script>";
    exit;
}

 

posted @ 2014-03-31 11:21  狂奔的蜗牛Snails  阅读(204)  评论(0编辑  收藏  举报