isMobile() ? ($d">
当前位置:Gxlcms > PHP教程 > device-PHP以判断移动设备跳转,怎么回跳?

device-PHP以判断移动设备跳转,怎么回跳?

时间:2021-07-01 10:21:17 帮助过:24人阅读

require(dirname(__FILE__)."/lib/Mobile_Detect.php");
$detect = new Mobile_Detect;
$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');

if($_SERVER["SERVER_NAME"] == "nj.xxx.cn" ){        
    if($deviceType == "phone") {
        header("Location:http://m.xxx.cn/");
        exit();
    }
}

已经判断移动设备

在手机端点使用电脑版 应该怎么处理

回复内容:

require(dirname(__FILE__)."/lib/Mobile_Detect.php");
$detect = new Mobile_Detect;
$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');

if($_SERVER["SERVER_NAME"] == "nj.xxx.cn" ){        
    if($deviceType == "phone") {
        header("Location:http://m.xxx.cn/");
        exit();
    }
}

已经判断移动设备

在手机端点使用电脑版 应该怎么处理

写session或者cookie,记录客户已经点击了使用电脑版本,然后在判断移动设备的地方加上session判断

人气教程排行