手机访问PC页面时自动跳转到移动端页面

public function _initialize()  
    {  
        $agent = $_SERVER['HTTP_USER_AGENT'];
        $toUrl = '';//页面跳转的页面-》移动端页面
		if(strpos($agent,"comFront") || strpos($agent,"iPhone") || strpos($agent,"MIDP-2.0") || strpos($agent,"Opera Mini") || strpos($agent,"UCWEB") || strpos($agent,"Android") || strpos($agent,"Windows CE") || strpos($agent,"SymbianOS"))
		header("Location:$toUrl");
    }  

你可能感兴趣的:(PHP)