Phpob_flush, and flush buffer in ie are invalid solutions. The buffer of the PHP program, regardless of the circumstances in which PHP is executed (CGI, web server, etc ). This function sends all the output of the program so far to the user's browser. The flush () function does not buffer PHP programs, regardless of the situation in which PHP is executed (CGI, web server, etc ). This function sends all the output of the program so far to the user's browser.
The flush () function does not affect the cache mode of the server or client browser. Therefore, you must use both the ob_flush () and flush () functions to refresh the output buffer.
Some web server programs, especially the web server programs under Win32, will cache the script output until the program ends before sending the results to the browser.
I wrote a small example to output a number every second on the page.
Follow the online code:
The code is as follows:
Ob_end_clean ();
For ($ I = 10; $ I> 0; $ I --)
{
Echo $ I;
Flush ();
Sleep (1 );
}
Or:
The code is as follows:
For ($ I = 10; $ I> 0; $ I --)
{
Echo $ I;
Ob_flush ();
Flush ();
Sleep (1 );
}
I found that it takes effect in Firefox, but it does not take effect in IE. each time it is output with 10 numbers, this indicates that the buffer has not taken effect.
I started to adjust the output_buffering settings in php. ini, and restarted apache, which is still invalid.
Then I saw a passage:
In some versions of Microsoft Internet Explorer, the page is displayed only after 256 bytes are received. Therefore, some extra spaces must be sent for these browsers to display the page content.
The evil IE browser has many TMD problems!
Then I modified the program and it was normal:
The code is as follows:
Echo str_pad (', 4096 );
For ($ I = 0; $ I <10; $ I ++ ){
Echo $ I;
Ob_flush ();
Flush ();
Sleep (1 );
}
The code is as follows:
// Ob_end_flush (); // IE8 does not work
Echo str_pad ("", 256); // IE must receive 256 bytes before Display starts
For ($ I = 0; $ I <18; $ I ++ ){
Echo $ I;
Flush ();
Sleep (1 );
}
CGI, web server, and so on ). This function sends all the output of the program so far to the user's browser. The flush () function does not...