Home > Backend Development > PHP Tutorial > 调用ob_end_flush()网页仍旧不能显示有关问题

调用ob_end_flush()网页仍旧不能显示有关问题

WBOY
Release: 2016-06-13 10:34:31
Original
776 people have browsed it

调用ob_end_flush()网页仍旧不能显示问题?
写了一个简单的demo,理论上调用ob_end_flush()后,浏览器端应该马上显示网页,但是结果却是整个php文件运行完成才刷新出来,如下代码

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php @ob_start();include 'test.tpl.php';@ob_end_flush();sleep(3);//---------------------------------// invoke client js$s = sprintf("\n<script>%s.%s();", 'oCar', 'updateDiv1');// output the buffer to clientecho $s;unset($s);@flush();//----------------------------------sleep(3);// invoke client js$s = sprintf("\n<script>%s.%s();</script>", 'oCar', 'updateDiv2');// output the buffer to clientecho $s;unset($s);@flush();
Copy after login


------解决方案--------------------
试试改下php.ini对于输出的设置
output_buffering = Off // 如果设置为On ,那么默认会先缓存4096B的输出内容
implicit_flush = On // I don't know...
 http://dao.daimaku.com/post/view/id/158
------解决方案--------------------
浏览器缓存
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