Calling ob_flush() and flush(), yet browser doesn't show any output until script finishes

后端 未结 12 2819
离开以前
离开以前 2020-12-07 00:55

Hi Please View Below Code :

\\n\";
for( $i = 0 ; $i < 10 ; $i++ )
{
    echo \"$i
\\n\";
12条回答
  •  死守一世寂寞
    2020-12-07 01:11

    Try removing the call to ob_start() on your first line : there is no need for you to enable output buffering -- and it probably causes troubles, here.


    I've tested your code :

    • If ob_start() is called on the first line, I only see the output when the script finishes, after 10 seconds
    • If I remove that call to ob_start(), then, I see one line of output every second, as soon as it's displayed on the standard output.

提交回复
热议问题