//获取浏览器类型
function getBrowser() {
$user_OSagent = $_SERVER['HTTP_USER_AGENT'];
if (strpos($user_OSagent, "Maxthon") && strpos($user_OSagent, "MSIE")) {
$visitor_browser = "Maxthon(Microsoft IE)";
} elseif (strpos($user_OSagent, "Maxthon 2.0")) {
$visitor_browser = "Maxthon 2.0";
} elseif (strpos($user_OSagent, "Maxthon")) {
$visitor_browser = "Maxthon";
} elseif (strpos($user_OSagent, "Edge")) {
$visitor_browser = "Edge";
} elseif (strpos($user_OSagent, "Trident")) {
$visitor_browser = "IE";
} elseif (strpos($user_OSagent, "MSIE")) {
$visitor_browser = "IE";
} elseif (strpos($user_OSagent, "MSIE")) {
$visitor_browser = "MSIE 较高版本";
} elseif (strpos($user_OSagent, "NetCaptor")) {
$visitor_browser = "NetCaptor";
} elseif (strpos($user_OSagent, "Netscape")) {
$visitor_browser = "Netscape";
} elseif (strpos($user_OSagent, "Chrome")) {
$visitor_browser = "Chrome";
} elseif (strpos($user_OSagent, "Lynx")) {
$visitor_browser = "Lynx";
} elseif (strpos($user_OSagent, "Opera")) {
$visitor_browser = "Opera";
} elseif (strpos($user_OSagent, "MicroMessenger")) {
$visitor_browser = "微信浏览器";
} elseif (strpos($user_OSagent, "Konqueror")) {
$visitor_browser = "Konqueror";
} elseif (strpos($user_OSagent, "Mozilla/5.0")) {
$visitor_browser = "Mozilla";
} elseif (strpos($user_OSagent, "Firefox")) {
$visitor_browser = "Firefox";
} elseif (strpos($user_OSagent, "U")) {
$visitor_browser = "Firefox";
} else {
$visitor_browser = "其它";
}
return $visitor_browser;
}
echo getBrowser();
?>