怎么获取手机型号

WBOY
풀어 주다: 2016-06-13 12:19:58
원래의
1872명이 탐색했습니다.

如何获取手机型号?
我想获取登录用户的终端型号,
作出如下的统计。
也试过了moblie_detect类,
但是这个类里面有的手机型号不全,而且没有小米,华为等等的型号,
我自己找又找不到具体手机的型号。 
我最终是要获取手机的品牌

------解决思路----------------------

<br /><?php<br />$user_agent = $_SERVER['HTTP_USER_AGENT'];<br />	if (stripos($user_agent, "iPhone")!==false) {<br />		$brand = 'iPhone';<br />	} else if (stripos($user_agent, "SAMSUNG")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> stripos($user_agent, "Galaxy")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "GT-")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "SCH-")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "SM-")!==false) {<br />		$brand = '三星';<br />	} else if (stripos($user_agent, "Huawei")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> stripos($user_agent, "Honor")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> stripos($user_agent, "H60-")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> stripos($user_agent, "H30-")!==false) {<br />		$brand = '华为';<br />	} else if (stripos($user_agent, "Lenovo")!==false) {<br />		$brand = '联想';<br />	} else if (strpos($user_agent, "MI-ONE")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "MI 1S")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "MI 2")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "MI 3")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "MI 4")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "MI-4")!==false) {<br />		$brand = '小米';<br />	} else if (strpos($user_agent, "HM NOTE")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "HM201")!==false) {<br />		$brand = '红米';<br />	} else if (stripos($user_agent, "Coolpad")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "8190Q")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "5910")!==false) {<br />		$brand = '酷派';<br />	} else if (stripos($user_agent, "ZTE")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> stripos($user_agent, "X9180")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> stripos($user_agent, "N9180")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> stripos($user_agent, "U9180")!==false) {<br />		$brand = '中兴';<br />	} else if (stripos($user_agent, "OPPO")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "X9007")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "X907")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "X909")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "R831S")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "R827T")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "R821T")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "R811")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "R2017")!==false) {<br />		$brand = 'OPPO';<br />	} else if (strpos($user_agent, "HTC")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> stripos($user_agent, "Desire")!==false) {<br />		$brand = 'HTC';<br />	} else if (stripos($user_agent, "vivo")!==false) {<br />		$brand = 'vivo';<br />	} else if (stripos($user_agent, "K-Touch")!==false) {<br />		$brand = '天语';<br />	} else if (stripos($user_agent, "Nubia")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> stripos($user_agent, "NX50")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> stripos($user_agent, "NX40")!==false) {<br />		$brand = '努比亚';<br />	} else if (strpos($user_agent, "M045")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "M032")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "M355")!==false) {<br />		$brand = '魅族';<br />	} else if (stripos($user_agent, "DOOV")!==false) {<br />		$brand = '朵唯';<br />	} else if (stripos($user_agent, "GFIVE")!==false) {<br />		$brand = '基伍';<br />	} else if (stripos($user_agent, "Gionee")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> strpos($user_agent, "GN")!==false) {<br />		$brand = '金立';<br />	} else if (stripos($user_agent, "HS-U")!==false <br><font color='#FF8000'>------解决思路----------------------</font><br> stripos($user_agent, "HS-E")!==false) {<br />		$brand = '海信';<br />	} else if (stripos($user_agent, "Nokia")!==false) {<br />		$brand = '诺基亚';<br />	} else {<br />		$brand = '其他手机';<br />	}<br />echo $brand;<br />?><br />
로그인 후 복사

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿