首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

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

2012-08-10 
调用ob_end_flush()网页仍旧不能显示问题?写了一个简单的demo,理论上调用ob_end_flush()后,浏览器端应该马

调用ob_end_flush()网页仍旧不能显示问题?
写了一个简单的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
[解决办法]
浏览器缓存

热点排行