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");
} 手机访问PC页面时自动跳转到移动端页面
最新推荐文章于 2024-02-07 17:40:04 发布
本文介绍了一种通过PHP脚本检测客户端是否为移动设备的方法,并实现了自动跳转至移动端页面的功能。通过检查HTTP_USER_AGENT字符串来判断用户是否使用了手机或其他移动设备访问网站。

1906

被折叠的 条评论
为什么被折叠?



