window下php ping的实现

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>window下ping的实现</title>
</head>

<body>
<?php

/**
 * Created by PhpStorm.
 * User: ouj
 * Date: 2015/4/14 0014
 * Time: 10:58
 */
//$_SERVER["REQUEST_URI"];
header("content-Type:text/html;charset=utf-8");  //PHP页面设置转为UTF-8编码

$domain=$_GET['domain'];
$count=$_GET['cishu'];
echo "域名:".$domain."<br>";
echo "次数:".$count."<br>";

echo "<font color=red><b>Pinging</b></font><br>";
$to_ping = $domain;
//$psize = 1;
echo " Please be patient, this can take a few moments...\n<br><br>";
flush();?>


    <pre><!--pre 元素可定义预格式化的文本。被包围在 pre 元素中的文本通常会保留空格和换行符。而文本也会呈现为等宽字体。-->

                <?php /** @var TYPE_NAME $to_ping */
                header("content-Type:text/html;charset=utf-8");  //PHP页面设置转为UTF-8编码
               // exec("ping -c $count -s $psize $to_ping", $list);
                exec("ping -n $count $to_ping",$list);
               // echo  count($list);
                for ($i=0;$i < count($list);$i++) {
                  // print(iconv("gbk","utf-8",$list[$i])."\n") ;
                    print_r(iconv("gbk","utf-8",$list[$i])."\n") ;
                }
                ?>
        </pre>
    <?php
    flush();//刷新PHP程序的缓冲,而不论PHP执行在何种情况下(CGI ,web服务器等等)。该函数将当前为止程序的所有输出发送到用户的浏览器
    sleep(3);



?>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值