获得客户端使用操作系统类型的php代码

2018-07-20    来源:open-open

容器云强势上线!快速搭建集群,上万Linux镜像随意使用
function userOS(){  
      $user_OSagent = $_SERVER['HTTP_USER_AGENT'];  
    if(strpos($user_OSagent,"NT 6.1")){  
        $visitor_os ="Windows 7";   
    } elseif(strpos($user_OSagent,"NT 5.1")) {   
       $visitor_os ="Windows XP (SP2)";   
    } elseif(strpos($user_OSagent,"NT 5.2") && strpos($user_OSagent,"WOW64")){   
       $visitor_os ="Windows XP 64-bit Edition";   
   } elseif(strpos($user_OSagent,"NT 5.2")) {  
        $visitor_os ="Windows 2003";   
   } elseif(strpos($user_OSagent,"NT 6.0")) {  
        $visitor_os ="Windows Vista";   
    } elseif(strpos($user_OSagent,"NT 5.0")) {  
      $visitor_os ="Windows 2000";   
    } elseif(strpos($user_OSagent,"4.9")) {  
       $visitor_os ="Windows ME";  
    } elseif(strpos($user_OSagent,"NT 4")) {  
       $visitor_os ="Windows NT 4.0";  
    } elseif(strpos($user_OSagent,"98")) {  
      $visitor_os ="Windows 98";  
   } elseif(strpos($user_OSagent,"95")) {  
        $visitor_os ="Windows 95";  
    }elseif(strpos($user_OSagent,"NT")) {  
        $visitor_os ="Windows 较高版本";  
    }elseif(strpos($user_OSagent,"Mac")) {  
        $visitor_os ="Mac";  
    } elseif(strpos($user_OSagent,"Linux")) {   
        $visitor_os ="Linux";  
    } elseif(strpos($user_OSagent,"Unix")) {  
        $visitor_os ="Unix";  
    } elseif(strpos($user_OSagent,"FreeBSD")) {  
        $visitor_os ="FreeBSD";  
    } elseif(strpos($user_OSagent,"SunOS")) {  
        $visitor_os ="SunOS";   
    } elseif(strpos($user_OSagent,"BeOS")) {  
        $visitor_os ="BeOS";   
    } elseif(strpos($user_OSagent,"OS/2")) {  
        $visitor_os ="OS/2";  
    } elseif(strpos($user_OSagent,"PC")) {  
        $visitor_os ="Macintosh";  
    } elseif(strpos($user_OSagent,"AIX")) {  
        $visitor_os ="AIX";  
    } elseif(strpos($user_OSagent,"IBM OS/2")) {  
        $visitor_os ="IBM OS/2";  
    } elseif(strpos($user_OSagent,"BSD")) {  
        $visitor_os ="BSD";  
   } elseif(strpos($user_OSagent,"NetBSD")) {  
        $visitor_os ="NetBSD";  
    } else {  
       $visitor_os ="其它操作系统";  
    }  
    return $visitor_os;   
} 

标签: linux

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。

上一篇:图片缩放水印PHP类

下一篇:php过滤html标签