判断用户设备类型
根据$_SERVER['HTTP_USER_AGENT']判断用户设备类型
1 public function AndroidOrIOS(){ 2 //dump($_SERVER); 3 $useragent=strtolower($_SERVER['HTTP_USER_AGENT']); 4 $type=''; 5 if(strpos($useragent,'android')){ 6 $type='android'; 7 } 8 if(strpos($useragent,'iphone')||strpos($useragent,'ipad')){ 9 $type='ios'; 10 } 11 if(strpos($useragent,'win64')||strpos($useragent,'win32')){ 12 $type='windows'; 13 } 14 echo $type; 15 }