Forget where to get the function, just can't find in a bag, temporarily saved up
/** * whether mobile Access * * @return bool */function ismobile () { // If Http_x_wap_profile is a mobile device if (isset ($_server[' Http_x_wap_profile '])) { return true; } // If via information contains WAP, it must be a mobile device, some service associations block this information if (isset ($_server[' Http_via ')) { // not found for flase, otherwise True return stristr ($_server[' Http_via '], "WAP") ? true : false; } // brain Residue method, determine the mobile phone to send the client logo, compatibility needs to be improved if (isset ($_ server[' Http_user_agent ')) { $ clientkeywords = array  (' Nokia ', ' Sony ', ' Ericsson ', ' mot ', ' Samsung ', ' HTC ', ' SGH ', ' LG ', ' Sharp ', ' sie-', ' Philips ', ' Panasonic ', ' Alcatel ', ' Lenovo ', ' iphone ', ' ipod ', ' BlackBerry ', ' Meizu ', ' Android ', ' NetFront ', ' Symbian ', ' UCWeb ', ' WindowsCE ', ' Palm ', ' Operamini ', ' Operamobi ', ' Openwave ', ' Nexusone ', ' CLDC ', ' MIDP ', ' WAP ', ' mobile ' ); Find the keyword if (Preg_match ("/(") for your phone's browser from Http_user_agent . implode (' | ', $clientkeywords) . ")/I", strtolower ($_server[' http_user_agent ') ))) { return true; } } // protocol law, because there may be inaccuracies, put to Final Judgment if (isset ($_server[' http_accept '))) { // If only WML is supported and HTML is not supported it must be a mobile device // If WML and HTML are supported but WML before HTML is mobile device if ((Strpos ($_server[' http_ ACCEPT '], ' vnd.wap.wml ') !== false) && (Strpos ($_server[' http_accept '], ' text/html ') === false | | (Strpos ($_server[' http_accept '], ' vnd.wap.wml ') < strpos ($_server[' http_accept '), ' text/html ')) { return true; } } return false;}
PHP function to determine whether the computer-side browser access Access or mobile browser access