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

后端 未结 8 426
误落风尘
误落风尘 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:40

    Start your investigation here:

    http://httpd.apache.org/docs/1.3/misc/FAQ-F.html#nph-scripts

    0 讨论(0)
  • 2020-12-17 21:44
    function printnow($str, $bbreak=true){
        print "$str";
        if($bbreak){
            print "<br />";
        }
        ob_flush(); flush();
    }
    

    Obviously this isn't going to behave if you pass it complicated objects (or at least those that don't implement __toString) but, you get the idea.

    0 讨论(0)
提交回复
热议问题