php判断是PC访问网址,是手机跳到M站点
<?php function zzk_check_phone_agent(){ if(stristr($_SERVER['HTTP_VIA'],"wap")){// 先检查是否为wap代理,准确度高 return true; }elseif(strpos(strtoupper($_SERVER['HTTP_ACCEPT']),"VND.WAP.WML") > 0){// 检查浏览器是否接受 WML. return true; }elseif(preg_match('/(blackberry|htc |htc_|htc-|motorola|nokia|opera mini|android|iphone|ipod|sonyericsson|symbian|up.browser|up.link|windows ce|windows mobile)/i', $_SERVER['HTTP_USER_AGENT'])){//检查USER_AGENT return true; }else{ return false; } } if(zzk_check_phone_agent()){ echo '<script>'; echo 'window.location="http://m.baidu.cn"'; echo '</script>'; exit(); } ?>
原文链接:http://www.gonghaibo.cn/life/2018-01-08/174.html
相关推荐
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
Noneyes 2020-11-10
mathchao 2020-10-28
王志龙 2020-10-28
wwwsurfphpseocom 2020-10-28
diskingchuan 2020-10-23
savorTheFlavor 2020-10-23