Home > Backend Development > PHP Tutorial > ob_start()无效,如何解决

ob_start()无效,如何解决

WBOY
Release: 2016-06-13 13:51:37
Original
1082 people have browsed it

ob_start()无效,怎么解决
ob_start();
for($i=0; $i
for ($i=10; $i>0; $i--)
{
  echo $i;
  flush();
  sleep(1); 
}
?>
 不能间隔1秒输出,而是一起输出,乍解决??

------解决方案--------------------
你可以这样试一试,也许可以

PHP code

ob_start();
ob_end_flush();
for($i = 1; $i <font color="#e78608">------解决方案--------------------</font><br>这样写
Copy after login
PHP code
for ($i=10; $i>0; $i--)
{
  echo $i . str_repeat(' ', 256);
  flush();
  ob_flush();
  sleep(1);  
}
<br><font color="#e78608">------解决方案--------------------</font><br><?php <br />ob_start();<br>echo str_repeat(' ', 4096); //不到这个数,不会发往客户端<br>flush();<br>for($i=0; $i<br>for ($i=10; $i>0; $i--)<br>{<br> echo $i;<br> flush();<br> sleep(1); <br>}<br>?><br> <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
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