php执行ping命令
<meta charset='utf-8'> <?php $descriptorspec = [ ['pipe','r'], ['pipe','w'], ['pipe','w'], ]; $commmand='ping baidu.com'; $process=popen($commmand,'r'); while($b=fgets($process,2028)){ echo iconv('gbk','utf-8',$b),'<br>'; ob_flush(); flush(); } pclose($process);