直接自适应不香么?不过你这种可以解决,用js判断请求头跳转到不同页面,不过这样不符合mip标准。
手机版分开
- 时间:
- 浏览:2715
- 来源:MIP建站系统交流平台
请问各位老手,我想模仿一个含有m手机版的站,要怎么才能分开呢?
3个回答


<?php
////这段放手机站里
header("Cache-Control: no-cache");
header("Pragma: no-cache");
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
$uachar = "/(symbianos|android|Mac OS|ucweb|blackberry)/i";
if($ua != '' && !preg_match($uachar, $ua)){
echo 'window.location.href="电脑地址";';
exit();
}
?>
<?php
//这段放在网站里
header("Cache-Control: no-cache");
header("Pragma: no-cache");
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
$uachar = "/(symbianos|android|Mac OS|ucweb|blackberry)/i";
if($ua != '' && preg_match($uachar, $ua)){
echo 'window.location.href="手机地址";';
exit();
}
?>
