Home > php教程 > PHP源码 > body text

根据ping的返回值判断电脑是否在线

PHP中文网
Release: 2016-05-25 17:11:03
Original
1815 people have browsed it


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 "";
	}
}
?>
Copy after login

                   

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template