<!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>
window下php ping的实现
最新推荐文章于 2023-02-26 13:27:47 发布