写了一个简单的demo,理论上调用ob_end_flush()后,浏览器端应该马上显示网页,但是结果却是整个php文件运行完成才刷新出来,如下代码
- PHP code
<?php@ob_start();include 'test.tpl.php';@ob_end_flush();sleep(3);//---------------------------------// invoke client js$s = sprintf("\n<script>%s.%s();</script>", '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();
------解决方案--------------------
试试改下php.ini对于输出的设置
output_buffering = Off // 如果设置为On ,那么默认会先缓存4096B的输出内容
implicit_flush = On // I don't know...
http://dao.daimaku.com/post/view/id/158
------解决方案--------------------
浏览器缓存