Measure the test taker's understanding about the differences between ob_flush and flush.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.