Phpob_flushflush output cache instance and description _ PHP Tutorial

Source: Internet
Author: User
Phpob_flushflush outputs cache instances and descriptions. Before using ob_flush (), make sure that the preceding content is 4069 characters in size. The output_buffering of some Web servers is 4069 characters or larger by default, that is, the output content must reach 4069 characters before the server uses ob_flush (). make sure that the preceding content is 4069 characters long enough. The output_buffering of some Web servers is 4069 characters or larger by default, that is, the output content must reach 4069 characters before the server will flush refresh the output buffer. to ensure that flush is effective

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) repeat the specified number of times.


// Instance 2

@ 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 );


/*
Note:
The use of flush and ob_flush is especially prone to errors, resulting in the failure to refresh the output buffer.

1. the correct order of flush and ob_flush should be: first ob_flush and then flush, as shown below:

Reference content is as follows:

Ob_flush ();
Flush ();

If the operating system of the web server is windows, the order is reversed or the ob_flush () is not used. However, in linux, the output buffer cannot be refreshed.

2. before using ob_flush (), make sure that the preceding content is 4069 characters long enough.
The output_buffering of some web servers is 4069 characters or larger by default, that is, the output content must reach 4069 characters before the server will flush refresh the output buffer. to ensure that flush is effective


Before begin (), make sure that the preceding content is 4069 characters long enough. The output_buffering of some Web servers is 4069 characters or larger by default, that is, the output content must exceed 4069 characters on the server...

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.