Home  >  Article  >  Backend Development  >  php 获取浏览器姓名

php 获取浏览器姓名

WBOY
WBOYOriginal
2016-06-13 13:02:08940browse

php 获取浏览器名称

if (strpos($_SERVER[HTTP_USER_AGENT], 'Maxthon')) {
??? $browser = 'Maxthon';
} elseif(strpos($_SERVER[HTTP_USER_AGENT], 'MSIE 8.0')) {
??? $browser = 'MSIE 8.0';
} elseif(strpos($_SERVER[HTTP_USER_AGENT], 'MSIE 7.0')) {
??? $browser = 'MSIE 7.0';
} elseif(strpos($_SERVER[HTTP_USER_AGENT], 'MSIE 6.0')) {
??? $browser = 'MSIE 6.0';
} elseif(strpos($_SERVER[HTTP_USER_AGENT], 'NetCaptor')) {
??? $browser = 'NetCaptor';
} elseif(strpos($_SERVER[HTTP_USER_AGENT], 'Netscape')) {
??? $browser = 'Netscape';
} elseif(strpos($_SERVER[HTTP_USER_AGENT], 'Lynx')) {
??? $browser = 'Lynx';
} elseif(strpos($_SERVER[HTTP_USER_AGENT], 'Opera')) {
??? $browser = 'Opera';
} elseif(strpos($_SERVER[HTTP_USER_AGENT], 'Konqueror')) {
??? $browser = 'Konqueror';
} elseif(strpos($_SERVER[HTTP_USER_AGENT], 'Firefox')) {
??? $browser = 'Firefox';
} elseif(strpos($_SERVER[HTTP_USER_AGENT],'Safari')) {
??? $browser = 'Safari';
} else {
??? $browser = 'other';
}
echo $browser;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn