查看系统配置

来源:互联网 发布:springboot初始化数据 编辑:程序博客网 时间:2024/06/11 13:20

 

代码和构思如下:

<?php
print_r($_SERVER);  //您可以打印看下服务数组里的所有内容信息看下,这样就可以迎刃而解拉。
echo "<br>";
echo "<b>---------------------以下是您要输出的内容----------------------------";
print_r($_SERVER['SCRIPT_FILENAME']);
echo "<br>";
 function getOS ()
     {
     $agent = $_SERVER['HTTP_USER_AGENT'];
     $os = false;
     if (eregi('win', $agent) && strpos($agent, '95')){//本函数和 ereg() 完全相同,只除了在匹配字母字符时忽略大小写的区别。


         $os = 'Windows 95';
     }
     else if (eregi('win 9x', $agent) && strpos($agent, '4.90')){
         $os = 'Windows ME';
     }
     else if (eregi('win', $agent) && ereg('98', $agent)){
         $os = 'Windows 98';
     }
     else if (eregi('win', $agent) && eregi('nt 5.1', $agent)){
         $os = 'Windows XP';
     }
     else if (eregi('win', $agent) && eregi('nt 5', $agent)){
         $os = 'Windows 2000';
     }
     else if (eregi('win', $agent) && eregi('nt', $agent)){
         $os = 'Windows NT';
     }
     else if (eregi('win', $agent) && ereg('32', $agent)){
         $os = 'Windows 32';
     }
     else if (eregi('linux', $agent)){
         $os = 'Linux';
     }
     else if (eregi('unix', $agent)){
        $os = 'Unix';
     }
     else if (eregi('sun', $agent) && eregi('os', $agent)){
         $os = 'SunOS';
     }
     else if (eregi('ibm', $agent) && eregi('os', $agent)){
         $os = 'IBM OS/2';
     }
     else if (eregi('Mac', $agent) && eregi('PC', $agent)){
         $os = 'Macintosh';
     }
     else if (eregi('PowerPC', $agent)){
         $os = 'PowerPC';
     }
     else if (eregi('AIX', $agent)){

         $os = 'AIX';
     }
     else if (eregi('HPUX', $agent)){
         $os = 'HPUX';
     }
     else if (eregi('NetBSD', $agent)){
         $os = 'NetBSD';
     }
     else if (eregi('BSD', $agent)){
         $os = 'BSD';
     }
     else if (ereg('OSF1', $agent)){
         $os = 'OSF1';
     }
     else if (ereg('IRIX', $agent)){
         $os = 'IRIX';
     }
     else if (eregi('FreeBSD', $agent)){
         $os = 'FreeBSD';
     }
     else if (eregi('teleport', $agent)){
         $os = 'teleport';
     }
     else if (eregi('flashget', $agent)){
         $os = 'flashget';
     }
     else if (eregi('webzip', $agent)){
         $os = 'webzip';
     }
     else if (eregi('offline', $agent)){
         $os = 'offline';
     }
     else {
         $os = 'Unknown';
     }
     return $os;
     }
echo getOS();
echo "<br>";
$p=$_SERVER['SERVER_SOFTWARE'];
echo strstr($p,'P');                                        //应用strstr()函数查找指定的关键字用于获取一个指定的字符串在另一个字符串中首次出现的位置到后者末尾的子字符串。如果成功,返回剩余字符串(存在相匹配的字符);否则返回false。

?>