PHP判断PC端和手机端

来源:互联网 发布:小学教师网络研修计划 编辑:程序博客网 时间:2024/05/16 12:18
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);$uachar = "/(nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|mobile|wap)/i";if(($ua == '' || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']),'wap')){header("Location: http://www.xx.com");}else{header("Location: http://www.00.com");}echo "<br/>".$ua;

0 0
原创粉丝点击