The PHP function determines whether the browser on the computer accesses the function or where the browser access on the mobile phone forgets to obtain the function. I just cannot find it in a package and save it temporarily.
/*** Whether to access the mobile terminal ** @ return bool */function isMobile () {// if there is HTTP_X_WAP_PROFILE, it must be a mobile device if (isset ($ _ SERVER ['http _ X_WAP_PROFILE ']) {return true ;} // if the via information contains wap, it must be a mobile device. some service providers will block this information if (isset ($ _ SERVER ['http _ VE']) {// cannot be found as flase; otherwise, it is true return stristr ($ _ SERVER ['http _ vean'], "wap ")? True: false;} // identify the client flag sent by the mobile phone. the 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', 'cld C ', 'midp', 'wap ', 'mobile'); // search for the keyword if (preg_match ("/(". implode ('|', $ clientkeywords ). ")/I", strtolower ($ _ SERVER ['http _ USER_AGENT ']) {return true ;}// resolution method, because it may be inaccurate, put it at the end to determine 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 is a mobile device before html (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 ;}