See what other people write, I don't know why this function is a service
function Is_mobile () {$user _agent = $_server[' http_user_agent ']; $mobile _agents = Array ("240x320", "Acer", "Acoon", "acs-", "Abacho", "Ahong", "Airness", "Alcatel", "Amoi", "Android", " applewebkit/525 "," applewebkit/532 "," Asus "," Audio "," Au-mic "," Avantogo "," Becker "," BenQ "," Bilbo "," Bird "," BlackBerry "," blazer "," Bleu "," cdm-"," Compal "," Coolpad "," Danger "," Dbtel "," Dopod "," Elaine "," Eric "," Etouch "," Fly ", "Fly_", "fly-", "Go.web", "goodaccess", "Gradiente", "Grundig", "Haier", "Hedy", "Hitachi", "HTC", "Huawei", "Hutchison", "Inno", "ipad", "iPAQ", "ipod", "Jbrowser", "KDDI", "kgt", "KWC", "Lenovo", "LG", "Lg2", "Lg3", "Lg4", "Lg5", "Lg7", "Lg8", " Lg9 "," lg-"," lge-"," Lge9 "," Longcos "," Maemo "," Mercator "," Meridian "," Micromax "," MIDP "," Mini "," Mitsu "," MMM "," MMP ", "Mobi", "mot-", "Moto", "nec-", "NetFront", "Newgen", "Nexian", "Nf-browser", "Nintendo", "Nitro", "Nokia", "Nook", " Novarra "," Obigo "," Palm "," Panasonic "," Pantech "," Philips "," Phone "," pg-"," PlayStation "," Pocket "," pt-"," qc-"," Qtek "," Rover "," Sagem "," sama "," Samu "," Sanyo "," Samsung "," sch-"," Scooter "," sec-"," Sendo "," sgh-"," Sharp "," Siemens "," sie-"," SoftBank "," Sony "," Spice "," Sprint "," SPV "," Symbian "," tablet "," Talkabout "," tcl-"," Teleca "," Telit "," Tianyu "," tim-"," Toshiba "," TSM "," Up.browser "," Utec "," Utstar "," Verykool "," Virgin "," vk-"," Voda "," Voxtel "," VX "," WAP "," Wellco "," Wig Browser "," Wii "," Windows CE "," wireless "," XDA "," Xde "," ZTE "); $is _mobile = false; foreach ($mobile _agents as $device) {if (Stristr ($user _agent, $device)) {$is _mobile = true; Break }} return $is _mobile; } $url = Explode ('/', $_server[' Request_uri ');
Reply to discussion (solution)
Check whether the current request terminal is a mobile phone or tablet, etc., general point is to detect whether it is a mobile terminal.
Mobile [English][?m?? ba?l][Mei][?mo?bl]
Adj. movable; The freedom of movement; susceptible to change; Liquidity;
N. Wind chimes; Phone
Is_mobile whether the cell phone
Through http_user_agent detection sources
Then the problem comes again.
What is the function of the following sentence and how it is parsed
$mobile _agents = Array ("240x320", "Acer", "Acoon", "acs-", "Abacho", "Ahong", "Airness", "Alcatel", "Amoi", "Android", " applewebkit/525 "," applewebkit/532 "," Asus "," Audio "," Au-mic "," Avantogo "," Becker "," BenQ "," Bilbo "," Bird "," BlackBerry "," blazer "," Bleu "," cdm-"," Compal "," Coolpad "," Danger "," Dbtel "," Dopod "," Elaine "," Eric "," Etouch "," Fly ", "Fly_", "fly-", "Go.web", "goodaccess", "Gradiente", "Grundig", "Haier", "Hedy", "Hitachi", "HTC", "Huawei", "Hutchison", "Inno", "ipad", "iPAQ", "ipod", "Jbrowser", "KDDI", "kgt", "KWC", "Lenovo", "LG", "Lg2", "Lg3", "Lg4", "Lg5", "Lg7", "Lg8", " Lg9 "," lg-"," lge-"," Lge9 "," Longcos "," Maemo "," Mercator "," Meridian "," Micromax "," MIDP "," Mini "," Mitsu "," MMM "," MMP ", "Mobi", "mot-", "Moto", "nec-", "NetFront", "Newgen", "Nexian", "Nf-browser", "Nintendo", "Nitro", "Nokia", "Nook", " Novarra "," Obigo "," Palm "," Panasonic "," Pantech "," Philips "," Phone "," pg-"," PlayStation "," Pocket "," pt-"," qc-"," Qtek "," Rover "," Sagem "," sama "," Samu "," Sanyo "," Samsung "," sch-"," Scooter "," sec-"," Sendo "," sgh-"," Sharp "," Siemens "," Sie-"," SoftBank "," Sony ","Spice", "Sprint", "SPV", "Symbian", "tablet", "Talkabout", "tcl-", "Teleca", "Telit", "Tianyu", "tim-", "Toshiba", "TSM", "Up.browser", "Utec", "Utstar", "Verykool", "Virgin", "vk-", "Voda", "Voxtel", "VX", "WAP", "Wellco", "Wig Browser", "Wii", "Windows CE", "wireless", "XDA", "Xde", "ZTE");
foreach ($mobile _agents as $device) {
if (Stristr ($user _agent, $device)) {
$is _mobile = true;
Break
}
}
Iterate through the $mobile _agents array and check if $_server[' Http_user_agent ') contains known information