继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

php 判断手机登陆

AI人工智能视频入门
关注TA
已关注
手记 330
粉丝 93
获赞 396



<?phpfunction isMobile(){$useragent=isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';$useragent_commentsblock=preg_match('|\(.*?\)|',$useragent,$matches)>0?$matches[0]:'';function CheckSubstrs($substrs,$text){foreach($substrs as $substr)if(false!==strpos($text,$substr)){return true;}return false;}$mobile_os_list=array('Google Wireless Transcoder','Windows CE','WindowsCE','Symbian','Android','armv6l','armv5','Mobile','CentOS','mowser','AvantGo','Opera Mobi','J2ME/MIDP','Smartphone','Go.Web','Palm','iPAQ');$mobile_token_list=array('Profile/MIDP','Configuration/CLDC-','160×160','176×220','240×240','240×320','320×240','UP.Browser','UP.Link','SymbianOS','PalmOS','PocketPC','SonyEricsson','Nokia','BlackBerry','Vodafone','BenQ','Novarra-Vision','Iris','NetFront','HTC_','Xda_','SAMSUNG-SGH','Wapaka','DoCoMo','iPhone','iPod');$found_mobile=CheckSubstrs($mobile_os_list,$useragent_commentsblock) ||CheckSubstrs($mobile_token_list,$useragent);if ($found_mobile){return true;}else{return false;}}if (isMobile())echo '手机登录m.php100.com';elseecho '电脑登录www.php100.com';?>

 

打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP