PHP Flush/ob_flush not working

前端 未结 7 2274
情深已故
情深已故 2020-11-27 07:03

I\'ve tried several attempts at getting my flush and ob_flush to work. I\'ve tried setting the ini to allow buffering, I\'ve tried using several different functions I found

7条回答
  •  一生所求
    2020-11-27 07:30

    I just wanted to write a quick note of what I've observed, now in 2016, of the different approached suggested:

    The above codes offered by netcoder and David work for me in the following browsers:

    • Chrome
    • Opera

    It does not seem to work in Firefox, Safari, or IE 10-11.

    I've also tested the alternative code:

     Line to show.";
            echo str_pad('',4096)."\n";    
    
            ob_flush();
            flush();
            sleep(2);
        }
    
        echo "Done.";
    
        ob_end_flush();
    ?>
    

    Which can be found here: http://php.net/manual/en/function.flush.php#54841

    Which seems to have better current support through all browsers:

    • Chrome
    • Firefox
    • Opera
    • Safari
    • IE 10
    • IE 11

    The working implementations seem to change year to year, so I wanted to offer an update of what I've found myself to work at the moment.

提交回复
热议问题