php判断用户是PC还是手机端源码

以下来检测用户是否为手机端源码:


function checkmobile() {
 $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
 $ualist = array('android', 'midp', 'nokia', 'mobile', 'iphone', 'ipod', 'blackberry', 'windows phone');
 if((dstrpos($useragent, $ualist) || strexists($_SERVER['HTTP_ACCEPT'], "VND.WAP") || strexists($_SERVER['HTTP_VIA'],"wap")))
 return true;
 else
 return false;
}



转载声明:本文为红盾科技技术分享平台的原创文章,转载请注明原文地址,谢谢合作

发表评论: