Maison > Article > développement back-end > 调用ob_end_flush()网页仍旧不能显示有关问题
调用ob_end_flush()网页仍旧不能显示问题?
写了一个简单的demo,理论上调用ob_end_flush()后,浏览器端应该马上显示网页,但是结果却是整个php文件运行完成才刷新出来,如下代码
<!--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();