Home > Article > Backend Development > In-depth understanding of the difference between ob_flush and flush, ob_flushflush_PHP tutorial
ob_flush/flush described in the manual, both refresh the output buffer, and need to be used together, so it will cause a lot of problems People are confused...
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.
So, ob_flush is to refresh PHP's own buffer.
And flush, strictly speaking, this is only available when PHP is installed as an Apache Module (handler or filter) Actual function. It refreshes the buffer of the WebServer (which can be considered to refer specifically to 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 Refresh 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, the Netscape browser caches content until it receives a line break or the beginning of an html tag, and does not display an entire table until it receives a tag.
Some versions of Microsoft Internet Explorer will only start displaying the page after receiving 256 bytes, so some extra spaces must be sent to allow these browsers to display the 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. However, in order to ensure the portability of your code, it is recommended to use them together.
www.laruence.com/2010/04/15/1414.html
flush: refers to blushing
blush: refers to blushing due to shame
flush: refers to blushing, which is a simple physiological reaction Blush: refers to blushing due to shame, emphasizing psychological reaction.