獲取瀏覽器類型
阿新 • • 發佈:2017-07-26
visit maxthon function tcap 微信瀏覽器 etc cape blog agent
1 function getBrowser() { 2 $user_OSagent = $_SERVER[‘HTTP_USER_AGENT‘]; 3 if (strpos($user_OSagent, "Maxthon") && strpos($user_OSagent, "MSIE")) { 4 $visitor_browser = "Maxthon(Microsoft IE)"; 5 } elseif (strpos($user_OSagent, "Maxthon 2.0")) { 6 $visitor_browser= "Maxthon 2.0"; 7 } elseif (strpos($user_OSagent, "Maxthon")) { 8 $visitor_browser = "Maxthon"; 9 } elseif (strpos($user_OSagent, "Edge")) { 10 $visitor_browser = "Edge"; 11 } elseif (strpos($user_OSagent, "Trident")) { 12 $visitor_browser = "IE";13 } elseif (strpos($user_OSagent, "MSIE")) { 14 $visitor_browser = "IE"; 15 } elseif (strpos($user_OSagent, "MSIE")) { 16 $visitor_browser = "MSIE 較高版本"; 17 } elseif (strpos($user_OSagent, "NetCaptor")) { 18 $visitor_browser = "NetCaptor"; 19 } elseif(strpos($user_OSagent, "Netscape")) { 20 $visitor_browser = "Netscape"; 21 } elseif (strpos($user_OSagent, "Chrome")) { 22 $visitor_browser = "Chrome"; 23 } elseif (strpos($user_OSagent, "Lynx")) { 24 $visitor_browser = "Lynx"; 25 } elseif (strpos($user_OSagent, "Opera")) { 26 $visitor_browser = "Opera"; 27 } elseif (strpos($user_OSagent, "MicroMessenger")) { 28 $visitor_browser = "微信瀏覽器"; 29 } elseif (strpos($user_OSagent, "Konqueror")) { 30 $visitor_browser = "Konqueror"; 31 } elseif (strpos($user_OSagent, "Mozilla/5.0")) { 32 $visitor_browser = "Mozilla"; 33 } elseif (strpos($user_OSagent, "Firefox")) { 34 $visitor_browser = "Firefox"; 35 } elseif (strpos($user_OSagent, "U")) { 36 $visitor_browser = "Firefox"; 37 } else { 38 $visitor_browser = "其它"; 39 } 40 return $visitor_browser; 41 }
獲取瀏覽器類型