Home >Backend Development >PHP Tutorial >How does php determine mobile client access?

How does php determine mobile client access?

WBOY
WBOYOriginal
2016-07-25 08:51:34990browse
  1. // check if wap
  2. function check_wap(){
  3. if(stristr($_SERVER['HTTP_VIA'],"wap")){// First check if it is a wap proxy, accurate High degree
  4. return true;
  5. }elseif(strpos(strtoupper($_SERVER['HTTP_ACCEPT']),"VND.WAP.WML") > 0){// Check whether the browser accepts WML.
  6. return true;
  7. }elseif(preg_match('/(blackberry|configuration/cldc|hp |hp-|htc |htc_|htc-|iemobile|kindle|midp|mmp|motorola|mobile|nokia|opera mini|opera |Googlebot-Mobile|YahooSeeker /M1A1-R2D2|android|iphone|ipod|mobi|palm|palmos|pocket|portalmmm|ppc;|smartphone|sonyericsson|sqh|spv|symbian|treo|up.browser|up.link|vodafone|windows ce|xda |xda_)/i', $_SERVER['HTTP_USER_AGENT'])){//Check USER_AGENT
  8. return true;
  9. }else{
  10. return false;
  11. }
  12. }
Copy code


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