简单的php获取linux服务器状态的代码,不多说-直接上函数: 复制代码 代码如下:function get_used_status(){ $fp = popen(‘top -b -n 2 | grep -E “^(Cpu|Mem|Tasks)”‘,”r”);//获取某一时刻系统cpu和内存使用情况 $rs = “”; while(!feof($fp)){ $rs .= fread($fp,1024); } pclose($fp); $sys_info = explode(“\n”,$rs); $tast_info = explode(“,”,$sys_info[3]);