Home  >  Article  >  php教程  >  检查是否是以手机浏览器进入

检查是否是以手机浏览器进入

WBOY
WBOYOriginal
2016-06-07 11:45:00946browse

检查是否是以手机浏览器进入
/**<br> * 检查是否是以手机浏览器进入(IN_MOBILE)<br> */<br> function isMobile() {<br>     $mobile = array();<br>     static $mobilebrowser_list ='Mobile|iPhone|Android|WAP|NetFront|JAVA|OperasMini|UCWEB|WindowssCE|Symbian|Series|webOS|SonyEricsson|Sony|BlackBerry|Cellphone|dopod|Nokia|samsung|PalmSource|Xphone|Xda|Smartphone|PIEPlus|MEIZU|MIDP|CLDC';<br>     //note 获取手机浏览器<br>     if(preg_match("/$mobilebrowser_list/i", $_SERVER['HTTP_USER_AGENT'], $mobile)) {<br>         return true;<br>     }else{<br>         if(preg_match('/(mozilla|chrome|safari|opera|m3gate|winwap|openwave)/i', $_SERVER['HTTP_USER_AGENT'])) {<br>             return false;<br>         }else{<br>             if($_GET['mobile'] === 'yes') {<br>                 return true;<br>             }else{<br>                 return false;<br>             }<br>         }<br>     }<br> }

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn