functionGetbrowsertype () {$is _mobile=false; $mobile _os_list=Array(' Google Wireless transcoder ', ' Windows CE ', ' windowsce ', ' Symbian ', ' Android ', ' armv6l ', ' armv5 ', ' Mobile ', ' CentOS ', ' Mowser ', ' AvantGo ', ' Opera Mobi ', ' J2ME/MIDP ', ' Smartphone ', ' go.web ', ' Palm ', ' IPAQ '); $mobile _token_list=Array(' PROFILE/MIDP ', ' configuration/cldc-', ' 160x160 ', ' 176x220 ', ' 240x240 ', ' 240x320 ', ' the ' + ', ' up '. Browser ', ' up. Link ', ' SymbianOS ', ' PalmOS ', ' PocketPC ', ' SonyEricsson ', ' Nokia ', ' BlackBerry ', ' Vodafone ', ' BenQ ', ' novarra-vision ', ' Iris ', ' NetFront ', ' htc_ ', ' Xda_ ', ' samsung-sgh ', ' Wapaka ', ' DoCoMo ', ' iPhone ', ' IPod '); $is _mobile=false; foreach($mobile _os_list as $key=$value) { if(Strpos($_server[' Http_user_agent '],$value)!==false){ $is _mobile=true; } } foreach($mobile _token_list as $key=$value) { if(Strpos($_server[' Http_user_agent '],$value)!==false){ $is _mobile=true; } } return $is _mobile; }
The return value true is the mobile side, false is the PC-side
Determine if the visitor is a PC or a mobile end