array("192.168.0.118","王五","行政",), "name4" =>array("192.168.0.140","李四","财务",), "name5" =>array("192.168.0.10","张三","后勤",), ); echo ""; echo "姓名"; echo "部门"; echo "状态"; foreach ($kkk as $ddd) { unset($result); exec("ping $ddd[0] -n 1",$result,$rval); if ($result[3] == $key){ echo "\n"; echo "$ddd[1]"; echo "$ddd[2]"; echo "离线"; echo ""; }else{ echo "\n"; echo "$ddd[1]"; echo "$ddd[2]"; echo "在线"; echo ""; } } ?>