Is there a way to have PHP print the data to a web browser in real time?

后端 未结 8 439
误落风尘
误落风尘 2020-12-17 21:00

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 wa

8条回答
  •  旧巷少年郎
    2020-12-17 21:37

    You can call flush() in PHP, but there are several other places that the output may be held (e.g. on the webserver). If you are using output buffering you need to call ob_flush() also.

    You may also find that some browsers will not render the page until the HTML is valid which won't be until all the tags are closed (like body, html)

提交回复
热议问题