判断访问接口的设备是安卓还是ios

//判断是安卓还是ios
function phontType(){
    //全部变成小写字母
    $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
    $type = 'other';
    //分别进行判断
    if(strpos($agent, 'iphone') || strpos($agent, 'ipad'))
    {
        $type = 'ios';
    }

    if(strpos($agent, 'android'))
    {
        $type = 'android';
    }
    return $type;
}

 

posted @ 2019-08-05 22:18  好笑。  阅读(431)  评论(0编辑  收藏  举报