Ob_flush/flush in the manual description, are refreshing output buffer, and also need to support the use, so will lead to a lot of people confused ...
In fact, they are different objects of operation, in some cases, flush do not do anything at all.
The Ob_* series function is the output buffer that operates on PHP itself.
So, Ob_flush is the buffer that refreshes PHP itself.
And flush, strictly speaking, this only in PHP as the Apache module (handler or filter) installed when the actual role. It is a buffer that refreshes the webserver (which can be considered specifically Apache).
Under the SAPI of Apache module, flush invokes the Flush member function pointer of the sapi_module and indirectly invokes Apache's Api:ap_rflush to refresh the Apache output buffer, which is also stated in the manual. There are some other Apache modules that may change the results of this action.
Some Apache modules, such as Mod_gzip, may have their own output caching, which will result in the results of the flush () function not being immediately sent to the client browser.
Even browsers will cache what they receive before it is displayed. For example, Netscape browser caches content before it accepts the start of a newline or HTML tag, and does not display the entire table until the </table> tag is accepted.
Some versions of Microsoft Internet Explorer will only start displaying the page after the 256 bytes received, so you must send some extra spaces to allow the browsers to display the page content.
So, the order in which the two are used correctly is. First Ob_flush, then flush,
Of course, in other sapi, do not call the flush can also, just to ensure that your code portability, recommended supporting use.
In IE, you must output 256 bytes before it works, following code:
Copy Code code as follows:
function Execte () {
echo Str_pad ("", 256);
For ($i =1 $i <10; $i + +) {
echo $i. " <Br> ";
Ob_flush ();
Flush ();
Sleep (1);
}
}