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

获取浏览器信息

时间:2014-11-12 21:23:54      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:android   http   io   ar   os   sp   on   cti   bs   

function getUserBrowser(){
     if (strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘Maxthon‘)) {
         $browser = ‘Maxthon‘;
     } elseif(strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘MSIE 12.0‘)) {
         $browser = ‘IE12.0‘;
     } elseif(strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘MSIE 11.0‘)) {
         $browser = ‘IE11.0‘;
     } elseif(strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘MSIE 10.0‘)) {
         $browser = ‘IE10.0‘;
     } elseif(strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘MSIE 9.0‘)) {
         $browser = ‘IE9.0‘;
     } elseif(strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘MSIE 8.0‘)) {
         $browser = ‘IE8.0‘;
     } elseif(strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘MSIE 7.0‘)) {
         $browser = ‘IE7.0‘;
     } elseif(strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘MSIE 6.0‘)) {
         $browser = ‘IE6.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‘], ‘Chrome‘)) {
         $browser = ‘Chrome‘;
     } elseif(strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘Firefox‘)) {
         $browser = ‘Firefox‘;
     } elseif(strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘Safari‘)) {
         $browser = ‘Safari‘;
     } elseif(strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘iphone‘) || strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘ipod‘)) {
         $browser = ‘iphone‘;
     } elseif(strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘ipad‘)) {
         $browser = ‘iphone‘;
     } elseif(strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘android‘)) {
         $browser = ‘android‘;
     } else {
         $browser = ‘other‘;
     }
     return $browser;
 }

获取浏览器信息

标签:android   http   io   ar   os   sp   on   cti   bs   

原文地址:http://my.oschina.net/guomingliang/blog/343685

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