1 functionIs_mobile () {2 //If you have http_x_wap_profile, it must be a mobile device .3 if(isset($_server[' Http_x_wap_profile ']))4 {5 return true;6 }7 //if the VIA message contains a WAP, it must be a mobile device, and some service providers block that information8 if(isset($_server[' Http_via ']))9 {Ten //not found for flase, otherwise true One return Stristr($_server[' Http_via '], "WAP")?true:false; A } - //brain Residue method, determine the mobile phone to send the client logo, compatibility needs to be improved - if(isset($_server[' Http_user_agent '])) the { - $clientkeywords=Array(' Nokia ', -' Sony ', -' Ericsson ', +' MOT ', -' Samsung ', +' HTC ', A' SGH ', at' LG ', -' Sharp ', -' Sie-', -' Philips ', -' Panasonic ', -' Alcatel ', in' Lenovo ', -' iphone ', to' ipod ', +' BlackBerry ', -' Meizu ', the' Android ', *' NetFront ', $' Symbian ',Panax Notoginseng' UCWeb ', -' WindowsCE ', the' Palm ', +' Operamini ', A' Operamobi ', the' Openwave ', +' Nexusone ', -' CLDC ', $' MIDP ', $' WAP ', -' Mobile ' - ); the //find keywords for your phone's browser from Http_user_agent - if(Preg_match("/(" .implode(' | ',$clientkeywords) . ")/I",Strtolower($_server[' Http_user_agent '])))Wuyi { the return true; - } Wu } - //protocol law, because there may be inaccuracies, put to the final Judgment About 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 - 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 ')))) A { + return true; the } - } $ return false; the}
Determine if your phone is logged in