PHP強迫輸出

Source: http://php.net/manual/en/function.ob-flush.php

some problems with ob_flush() and flush() could be resolved by defining content type header :
header( ‘Content-type: text/html; charset=utf-8’ );

so working code looks like this:

';
for( $i = 0 ; $i < 10 ; $i++ )
{
    echo $i . '
'; flush(); ob_flush(); sleep(1); } echo 'End ...
'; ?>
This entry was posted in PHP. Bookmark the permalink.