简单的Ping工具 - 显示每一行 [英] Simple Ping Tool - Display Each Line

查看:158
本文介绍了简单的Ping工具 - 显示每一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在创建简单的ping脚本,提示用户输入各种

参数。


然而,我希望ping的每一行都显示为

收到。目前,在ping完

之前,结果不会显示。


<?php


$ ping_ip_addr = $ _GET [''Host''];

$ ping_count = $ _GET [''Count''];

$ ping_size = $ _GET [' 'size''];


$ result = explode(" \ n",`ping -c $ ping_count -s $ ping_size

$ ping_ip_addr `);


print"< pre>" ;;


foreach($ result as $ val){

打印" $ val< br>" ;;

}


打印"< / pre>" ;;


?>


< font face =" verdana" size =" 2">< form action ="<?php echo

$ _SERVER [''PHP_SELF'']; ?>" method =" GET">

IP地址:< input type =" text"名称= QUOT;主机" />

计数:< input type =" text"名称= QUOT;计数"值= QUOT; 5英寸/>

大小:< input type =" text"名称= QUOT;尺寸"值= QUOT; 32" /?

< input type =" submit" value =" Ping Host"命名= [提交" />

< / form>


Matt Florido


I''m creating simple ping script that prompts a user for various
parameters.

However, I would like each line of the ping displayed as it
is received. Currently, the result isn''t displayed until the ping is
finished.

<?php

$ping_ip_addr = $_GET[''Host''];
$ping_count = $_GET[''Count''];
$ping_size = $_GET[''Size''];

$result = explode("\n", `ping -c $ping_count -s $ping_size
$ping_ip_addr`);

print "<pre>";

foreach($result as $val) {
print "$val<br>";
}

print "</pre>";

?>

<font face="verdana" size="2"><form action="<?php echo
$_SERVER[''PHP_SELF'']; ?>" method="GET">
IP Address: <input type="text" name="Host" />
Count: <input type="text" name="Count" value="5" />
Size: <input type="text" name="Size" value="32" /?
<input type="submit" value="Ping Host" name="Submit" />
</form>

Matt Florido

推荐答案

ping_ip_addr =
ping_ip_addr =


_GET [''主持人''];
_GET[''Host''];


ping_count =
ping_count =


这篇关于简单的Ping工具 - 显示每一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆