Author: Laruenc
The description of ob_flush/flush in the manual is to refresh the output buffer, and it also needs to be used in conjunction, so it will cause confusion to many people...
In fact, they operate on different objects. In some cases, flush does nothing at all..
The ob_* series of functions operate the output buffer of PHP itself.
Therefore, ob_flush is to flush PHP's own buffer.
And flush, strictly speaking, this only has practical effect when PHP is installed as apache Module (handler or filter). It refreshes the buffer of WebServer (which can be considered specifically apache).
Under the sapi of the apache module, flush will indirectly call the api of apache by calling the flush member function pointer of sapi_module: ap_rflush refreshes the output buffer of apache. Of course, the manual also says that there are some other modules of apache that may change. The result of this action..
Some Apache modules, such as mod_gzip, may perform output caching by themselves,
This will cause the results produced by the flush() function to not be sent to the client browser immediately.
Even browsers cache received content before displaying it. For example Netscape
The browser caches content until it receives a newline or the beginning of an html tag, and does so before
The entire table is not displayed until the tag is accepted.
Some versions of Microsoft Internet Explorer only accept 256
bytes later, so some extra spaces must be sent to make this
Some browsers display page content.
Therefore, the correct order to use the two is. First ob_flush, then flush,
Of course, under other sapi, you can not call flush, but in order to ensure the portability of your code, it is recommended to use it together