码迷,mamicode.com
首页 > 其他好文 > 详细

获取浏览器类型

时间:2017-07-26 15:40:35      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:版本   trident   ref   div   lynx   类型   cti   rom   高版本   

 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 }

 

获取浏览器类型

标签:版本   trident   ref   div   lynx   类型   cti   rom   高版本   

原文地址:http://www.cnblogs.com/719907411hl/p/7239800.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!