PHP ob_flush Flush Output Cache instance and Description _php tutorial

Source: Internet
Author: User
Before using Ob_flush (), make sure that the previous content is 4069 characters large enough. Some Web server output_buffering default is 4069 characters or larger, that is, the output must reach 4069 characters to flush the output buffer, in order to ensure that flush is valid

PHP tutorial Ob_flush Flush Output Cache instance and description

*/
Ob_flush ();
//
Flush ();
//
function Flush () {
Echo (Str_repeat (', 256));
Check that buffer is actually set before flushing
if (Ob_get_length ()) {
@ob_flush ();
@flush ();
@ob_end_flush ();
}
@ob_start ();
}


Str_repeat (String,repeat) repeats the string for the specified number of times.


Example Two

@apache_setenv (' No-gzip ', 1);
@ini_set (' Zlib.output_compression ', 0);
@ini_set (' Implicit_flush ', 1);
for ($i = 0; $i < Ob_get_level (); $i + +) {Ob_end_flush ();}
Ob_implicit_flush (1);


/*
Precautions for use:
The use of flush and ob_flush is particularly prone to mistakes, resulting in the inability to flush output buffers.

The correct order of flush and ob_flush should be, first ob_flush and then flush, as follows:

The following is the referenced content:

Ob_flush ();
Flush ();

If the Web server's operating system is a Windows system, then the order is reversed or not using Ob_flush () does not occur. However, the output buffer cannot be refreshed on a Linux system.

Two. Before using Ob_flush (), make sure that the previous content is 4069 characters long.
Some Web server output_buffering default is 4069 characters or larger, that is, the output must reach 4069 characters to flush the output buffer, in order to ensure that flush is valid


http://www.bkjia.com/PHPjc/445393.html www.bkjia.com true http://www.bkjia.com/PHPjc/445393.html techarticle before using Ob_flush (), make sure that the previous content is 4069 characters large enough. Some Web server output_buffering default is 4069 characters or larger, that is, the output must reach the 4069-character server ...

  • Related Article

    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.