php实现ping功能


PHP #ping2012-10-28 22:52

以下是相关实现代码:

<?php
// http://yige.org/php/

echo "<font color="red"><blink><b>Pinging</b></blink></font><br>"; 
$to_ping = "yige.org"; 
$count = 3; 
$psize = 65; 
echo " Please be patient, this can take a few moments... <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]." "; 
} 
?> 
</pre> 
<? 
flush(); 
sleep(3); 
} 
?>


相关文章

粤ICP备11097351号-1