/**
 * 获取当前访问的设备类型
 * @return integer 1:其他  2:iOS  3:Android
 */
function get_device_type(){
    //全部变成小写字母
    $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
    $type = 1;
    //分别进行判断
    if(strpos($agent, 'iphone')!==false || strpos($agent, 'ipad')!==false){
        $type = 2;
    } 
    if(strpos($agent, 'android')!==false){
        $type = 3;
    }
    return $type;
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
  • 2021-05-26
  • 2021-05-25
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2021-09-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案