有没有办法让PHP实时将数据打印到Web浏览器? [英] Is there a way to have PHP print the data to a web browser in real time?
本文介绍了有没有办法让PHP实时将数据打印到Web浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如,如果我有echo语句,则不能保证浏览器可以立即显示它,可以一次显示几十个echo语句,还可以等到整个页面完成后再显示任何内容.
For example, if I have an echo statement, there's no guarantee that the browser might display it right away, might display a few dozen echo statements at once, and might wait until the entire page is done before displaying anything.
是否有一种方法可以使每个回显在执行时显示在浏览器中?
Is there a way to have each echo appear in a browser as it is executed?
推荐答案
您可以使用 flush()
强制将缓冲区内容发送到浏览器.
You can use flush()
to force sending the buffer contents to the browser.
您可以使用" ob_implicit_flush(true)
"启用隐式刷新.
You can enable implicit flushing with "ob_implicit_flush(true)
".
这篇关于有没有办法让PHP实时将数据打印到Web浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文