PHP programs are buffered, regardless of the circumstances in which PHP executes (CGI, Web servers, etc.). This function sends all the output of the program so far to the user's browser.
The flush () function does not affect the caching mode of the server or client browser. Therefore, you must use both the Ob_flush () and the Flush () functions to refresh the output buffer.
Individual Web server programs, especially Web server programs under Win32, still cache the output of the script until the end of the program before sending the results to the browser.
*/
for ($i =10; $i >0; $i-)
{
echo $i;
Ob_flush ();
Flush ();
Sleep (1);
}
Microsoft Internet Explorer only starts displaying the page after 256 bytes received, so you must send some extra space to have the browser display the page content
Normal usage
Ob_start ();
Ob_end_flush ();
for ($i = 1; $i <=; $i + +) echo ' www.111cn.net ';
$i = 0;
while (1) {
echo $i;
Sleep (1);
$i + +;
}
For ($i =0 $i <10; $i + +) {
echo $i;
Flush ();
Sleep (1);
}
This code, should be output every second $i, but in practice is not necessarily the case, ie browser may be waiting for 10 seconds, all the output at the same time appear
Ob_end_flush () The//IE8 didn't work.
echo Str_pad ("", 256),//ie need to receive 256 bytes before starting the display
For ($i =0 $i <18; $i + +) {
echo $i;
Flush ();
Sleep (1);
}