Author: Laruenc
Ob_flush/flush descriptions in the manual are used to refresh the output buffer and must be used together, which may lead to many confusion...
In fact, they have different operation objects. In some cases, flush does nothing at all ..
Ob _ * series functions are used to operate the output buffer of PHP itself.
Therefore, ob_flush is used to refresh the PHP buffer.
But flush, strictly speaking, this is only useful when PHP is installed as an apache Module (handler or filter. it is used to refresh the buffer zone of the WebServer (which can be considered to be specific to apache.
In the sapi of apache module, flush indirectly calls apache api: ap_rflush to refresh apache output buffer by calling the flush member function pointer of sapi_module, some other modules of apache may change the result of this action ..
Some Apache modules, such as mod_gzip, May cache output by themselves,
This will cause the results produced by the flush () function to not be immediately sent to the client browser.
Even the browser caches the received content before it is displayed. For example, Netscape
The browser caches content before receiving a line break or the beginning of an html tag, and
The entire table is not displayed until the </table> mark is received.
Some versions of Microsoft Internet Explorer only receive 256
The page is displayed only after bytes. Therefore, some extra spaces must be sent
Some browsers display the page content.
Therefore, the correct order of the two users is: first ob_flush, then flush,
Of course, other sapis do not call flush, but we recommend that you use it to ensure the portability of your code.