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

ob_start()无效,如何解决

WBOY
WBOYOriginal
2016-06-13 09:59:421185browse

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>这样写
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>
Statement:
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