首页 > php教程 > PHP源码 > 正文

PHP获取浏览器型号

PHP中文网
发布: 2016-05-25 17:09:12
原创
1097 人浏览过

PHP代码

function userBrowser(){  
       $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,"MSIE 9.0")) {   
           $visitor_browser ="MSIE 9.0";   
       }elseif(strpos($user_OSagent,"MSIE 8.0")) {   
            $visitor_browser ="MSIE 8.0";   
       }elseif(strpos($user_OSagent,"MSIE 7.0")) {   
            $visitor_browser ="MSIE 7.0";   
        }elseif(strpos($user_OSagent,"MSIE 6.0")) {   
           $visitor_browser ="MSIE 6.0";   
        } elseif(strpos($user_OSagent,"MSIE 5.5")) {   
            $visitor_browser ="MSIE 5.5";   
        } elseif(strpos($user_OSagent,"MSIE 5.0")) {   
            $visitor_browser ="MSIE 5.0";   
        } elseif(strpos($user_OSagent,"MSIE 4.01")) {   
          $visitor_browser ="MSIE 4.01";   
        }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,"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;   
       }
登录后复制

                   

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门推荐
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!