PHP Seven kinds of cache control output instance code

Source: Internet
Author: User
Keywords Web Programming PHP Tutorials
Tags cache code control different echo note opened php

PHP tutorial Seven kinds of cache control output instance code
Depending on whether the cache is open or not, there are several different ways to do this:

Note: The following code does not consider the IE cache must be greater than 256 bytes to output the problem, such as in IE test, please add a sentence in the code: "Echo str_repeat (", 256)

Writing 1:
Output_buffering = Off
Implicit_flush=off


For ($i =0 $i <10; $i + +) {
echo $i. ' <br/> ';
Flush ();
Sleep (1);
}

Writing 2:
Output_buffering = On
Implicit_flush=off


For ($i =0 $i <10; $i + +) {
echo $i. ' <br/> ';
Ob_flush ();
Flush ();
Sleep (1);
}

Writing 3:
Output_buffering = Off
Implicit_flush=off

Ob_start ();
For ($i =0 $i <10; $i + +) {
echo $i. ' <br/> ';
Ob_flush ();
Flush ();
Sleep (1);
}


Writing 4:
Output_buffering = On
Implicit_flush=off


Ob_end_flush ();
For ($i =0 $i <10; $i + +) {
echo $i. ' <br/> ';
Flush ();
Sleep (1);
}


Writing 5:
Output_buffering = On
Implicit_flush=off

Ob_end_clean ();
For ($i =0 $i <10; $i + +) {
echo $i. ' <br/> ';
Flush ();
Sleep (1);
}


Writing 6:
Output_buffering = on;
Implicit_flush=on

Ob_end_clean ();
or Ob_end_flush ();
For ($i =0 $i <10; $i + +) {
echo $i. ' <br/> ';
Sleep (1);
}


Writing 7:
Output_buffering = on;
Implicit_flush=on

Ob_end_clean ();
or Ob_end_flush ();
For ($i =0 $i <10; $i + +) {
echo $i. ' <br/> ';
Flush ();
Sleep (1);
}


Writing 8:
Output_buffering = Off
Implicit_flush=on

For ($i =0 $i <10; $i + +) {
echo $i. ' <br/> ';
Sleep (1);
}

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.