Home > Backend Development > PHP Tutorial > In-depth understanding of the difference between ob_flush and flush_PHP Tutorial

In-depth understanding of the difference between ob_flush and flush_PHP Tutorial

WBOY
Release: 2016-07-13 17:48:31
Original
1236 people have browsed it

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478425.htmlTechArticleAuthor: Laruenc The descriptions of ob_flush/flush in the manual are all about refreshing the output buffer, and they need to be used together. , so it will cause many people to be confused. In fact, they operate on different objects,...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template