美文网首页
PHP获取手机信息

PHP获取手机信息

作者: Continue_li | 来源:发表于2019-12-11 11:43 被阅读0次

    获取手机信息

    function getMobileType(){
    HTTP_USER_AGENT=SERVER['HTTP_USER_AGENT'];
    iOS=array("iPhone","iPad","iPod","iTouch"); preg_match_all('/(?<=\()([^\]]*?)(?=\))/',HTTP_USER_AGENT, arr);tmp = str_replace("Linux; ","",arr[0][0]);tmp = str_replace("
    ",".",tmp);tmp = str_replace(" CPU iPhone OS ","",tmp);tmp = str_replace(" like Mac OS X","",tmp);tmp = str_replace(" Build","",tmp);osarr=explode(";",tmp); if(in_array(osarr[0],iOS)){mobile=explode("Mobile/",HTTP_USER_AGENT);mobile=explode(" ",mobile[1]);mobiletype="手机:".osarr[0]." 版本:".mobile[0]." 系统:iOS".osarr[1]; }else{mobile=explode("/",osarr[1]);mobiletype="手机:".mobile[0]." 版本:".mobile[1]." 系统:".osarr[0]; #其他系统 if(str_replace(" ","",osarr[0])=="U"){
    tmp = str_replace("Linux; U; ","",arr[0][0]);
    tmp = explode(" Build/",tmp);
    tmp = explode("; zh-cn; ",tmp[0]);
    mobiletype="手机:".tmp[1]." 系统:".tmp[0]; } } returnmobiletype;
    }

    相关文章

      网友评论

          本文标题:PHP获取手机信息

          本文链接:https://www.haomeiwen.com/subject/hojogctx.html