首页 > 语言 > PHP > 正文

PHP获取服务器端信息函数

2024-09-04 11:48:48
字体:大 中 小
来源:转载
供稿:网友
  1. /** 
  2.  * 获取系统信息 
  3.  * 
  4.  * @return array 
  5.  */ 
  6. function getSystemInfo() 
  7. { 
  8.  $systemInfo = array(); 
  9.   
  10.  // 系统 
  11.  $systemInfo['os'] = PHP_OS; 
  12.   
  13.  // PHP版本 
  14.  $systemInfo['phpversion'] = PHP_VERSION; 
  15.   
  16.  // Apache版本 
  17.  $systemInfo['apacheversion'] = apache_get_version(); 
  18.   
  19.  // ZEND版本 
  20.  $systemInfo['zendversion'] = zend_version(); 
  21.   
  22.  // GD相关 
  23.  if (function_exists('gd_info')) 
  24.  { 
  25.   $gdInfo = gd_info(); 
  26.   $systemInfo['gdsupport'] = true; 
  27.   $systemInfo['gdversion'] = $gdInfo['GD Version']; 
  28.  } 
  29.  else 
  30.  { 
  31.   $systemInfo['gdsupport'] = false; 
  32.   $systemInfo['gdversion'] = ''; 
  33.  } 
  34.   
  35.  // 安全模式 
  36.  $systemInfo['safemode'] = ini_get('safe_mode'); 
  37.   
  38.  // 注册全局变量 
  39.  $systemInfo['registerglobals'] = ini_get('register_globals'); 
  40.   
  41.  // 开启魔术引用 
  42.  $systemInfo['magicquotes'] = (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc()); 
  43.   
  44.  // 最大上传文件大小 
  45.  $systemInfo['maxuploadfile'] = ini_get('upload_max_filesize'); 
  46.  //开源软件:Vevb.com 
  47.  // 脚本运行占用最大内存 
  48.  $systemInfo['memorylimit'] = get_cfg_var("memory_limit") ? get_cfg_var("memory_limit") : '-'; 
  49.   
  50.  return $systemInfo; 
  51. }

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表