flush()函数无效?不能实时刷新输出,如何解决呢?
本帖最后由 zhoumengkang 于 2013-05-28 13:46:14 编辑
测试代码如下:
<?php<br />
for($i=0;$i<5;$i++){ <br />
echo '<br/>abc___'.$i;<br />
ob_flush();<br />
flush();<br />
sleep(1);<br />
}<br />
ob_end_flush();<br />
?>
Copy after login
理论上应该是1秒出来一条是吧?但是我测试的结果是5秒之后才一起出来。
网上查了下有这样说的“个别web服务器程序,特别是Win32下的web服务器程序,在发送结果到浏览器之前,仍然会缓存脚本的输出,直到程序结束为止。 ”我这个是64位的windows的本地xampp的集成环境。
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
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31