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

后端 未结 12 2798
离开以前
离开以前 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:15

    I've discovered that this was due to Apache's gzip compression being in use for my case.

    To turn gzip off for the 'flushing' script only, I created a new .htaccess file in the directory where the continuous output script resides, with the following:

    
        SetEnv no-gzip 1
    
    

    Flushing is working as expected again.

提交回复
热议问题