1#楼 |
|
|
回复人:一起PHP |
注册时间:2004-02-27 |
主题/回复:247/1521 |
积分:4649 |
等级:★★★★★☆(十一级) |
称号:论坛圣人 |
|
|
|
1#楼 发表于2005-05-06 23:12:45
评分:1
|
|
用exec()命令运行ping命令是可以的。不过关于自动刷新的问题还得自己去考虑解决办法,下面是一个用php实现ping的例子:
<?php
// created by joe lumbroso
// see some other good php3 scripts
// goto http://www.dtheatre.com/scripts
echo "<font color=\"red\"><blink><b>Pinging</b></blink></font><br>";
$to_ping = "dtheatre.com";
$count = 3;
$psize = 65;
echo " Please be patient, this can take a few moments...\n<br><br>";
flush();
while (1) {
?>
<pre>
<?
exec("ping -c $count -s $psize $to_ping", $list);
for ($i=0;$i < count($list);$i++) {
print $list[$i]."\n";
}
?>
</pre>
<?
flush();
sleep(3);
}
?>
|
|
2#楼 |
|
|
回复人:lather |
注册时间:2005-04-21 |
主题/回复:37/63 |
积分:1079 |
等级:★★★☆(七级) |
称号:论坛贤士 |
|
|
|
2#楼 发表于2005-05-07 02:22:57
评分:×
|
|
|