Home  >  Article  >  Backend Development  >  关于ob输出有关问题

关于ob输出有关问题

WBOY
WBOYOriginal
2016-06-13 11:50:15976browse

关于ob输出问题

<br /><?php<br />ob_start();<br />echo str_repeat(" ",4098);<br />for($i=65;$i<70;$i++){<br />	echo chr($i);<br />	ob_flush();<br />	flush();<br />	sleep(1);<br />}<br />?><br />


请问以上代码在IE,FF下均正常,可以依次输出ABCDE,而在谷歌浏览器下无法依次显示,而是一次输出ABCDE,原来以为是谷歌缓存过大加大str_repeat 为9000后仍是一次输出,不知道是什么原因?
------解决方案--------------------
不知道,360极速 是什么内核

本来这种输出就是很无聊的,以前只知道与服务器相关,现在又有了浏览器相关
可见成功就变成小概率事件了
毫无实用价值,不必把精力放在这上面


------解决方案--------------------
if (ob_get_level() == 0) ob_start();<br /><br />for ($i = 0; $i<10; $i++){<br /><br />	echo "<br> Line to show.";<br />	//echo str_pad('1',4096)."\n";<br />	echo str_repeat("1",4098);<br />	ob_flush();<br />	flush();<br />	sleep(2);<br />}<br /><br />echo "Done.";<br /><br />ob_end_flush();

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