php获取手机型号

public function model(){
        header("Content-type:text/html; charset=utf-8");
        $user_agent = $_SERVER['HTTP_USER_AGENT'];//返回手机系统、型号信息
        if(stristr($_SERVER['HTTP_USER_AGENT'], 'Android')){//返回值中是否有Android这个关键字
          $a =  explode(" ",$user_agent);
          $b = $a[6].$a[7];
            echo json_encode(array('model' =>$b));
        }else{
            if(stristr($_SERVER['HTTP_USER_AGENT'], 'iPhone')){
                $a =  explode(" ",$user_agent);
                echo json_encode(array('model' => $a[3]));
            }else{
                echo json_encode(array('model' => 'win系统'));
            }
        }
    }
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页