This snippet:
ob_start();
for($i=0;$i<70;$i++)
{
echo 'printing...<br />';
ob_flush();开发者_Go百科
flush();
usleep(300000);
}
From this page: http://www.php.net/manual/en/function.flush.php#85382
Isn't working on WAMP2 (PHP 5.3.0, Apache 2.2.11) installed on Windows 7, browsing from http://localhost with IE 8, FF 6.0.2 and Chrome 13.
None of them worked. All the 'printing...' lines are just output in one instant batch when the page finished processing.
output_buffering in php.ini is set to 'On'.
Any ideas why it isn't working?
Several reasons why flush fails are discussed on the ob_flush() documentation page (eg interference with certain antivirus sw's, interference with zlib compression, ...). Worth reading.
You may need to close the session:
echo 'printing...<br />';
session_write_close();
ob_flush();
flush();
精彩评论