下面代码本应显示
服务器速度,实际只是Web实现Ping ; 其实Cs中的速度跟Ping是不一样的 ,东西没做出来,这都是后话了。
代码发上来保存,以后有时间再完善吧。
| 代 码 : |
<?php echo "<font color=red><blink><b>Server Sniper</b></blink></font><br>";
$to_ping = $_GET[Server];
$Prot = ":" . $_GET[Port];
echo " 正在测试服务器速度...<br><br>";
flush();
?>
<pre>
<?php
exec("ping $to_ping $port", $list);
//for ($i=0;$i < count($list);$i++) { $i=count($list); $i--; $str= $list[$i];
?>
</pre>
<?php
flush();
sleep(3); //}
$str=strstr($str,"Average =");
echo "服务器速度:" . substr($str,strlen("Average =")); ?> |
|
代码如果你用的话还需要改,
环境上你可能是Unix系统-而这几行代码是根据Win系统写的;
其次如果你用虚拟机,牵扯到权限问题。[Last Edited By KusTa @ 2005-06-20 09:48 PM]
![]()
查看更多与本来想写个Cs的Web服务,又半途而废了,变成Web版的Ping了相关内容