Home > Backend Development > PHP Tutorial > PHP设置边执行边输出结果的方法

PHP设置边执行边输出结果的方法

WBOY
Release: 2016-06-20 13:05:15
Original
1720 people have browsed it

PHP设置边执行边输出结果的方法

这篇文章主要介绍了PHP中设置一边执行一边输出结果的实现代码,需要的朋友可以参考下

<?php   
 set_time_limit(10);   
 ob_end_clean();     //在循环输出前,要关闭输出缓冲区  

 echo str_pad('',1024);  
 //浏览器在接受输出一定长度内容之前不会显示缓冲输出,这个长度值 IE是256,火狐是1024  
 for($i=1;$i<=100;$i++){   
  echo $i.'<br/>';   
  flush();    //刷新输出缓冲  
  sleep(1);   
 }   
?>
​
Copy after login

 


Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template