PHP uses the output buffering method, outputbuffering

Source: Internet
Author: User

PHP uses the output buffering method, outputbuffering

PHP uses the method of caching output buffering. Share it with you for your reference. The details are as follows:

$ Buffer = ini_get ('output _ buffering '); echo str_repeat ('', $ buffer + 1); // prevents browser cache ob_end_flush (); // disable cache for ($ I = 1; $ I <= 10; $ I ++) {echo 'quarter '. $ I. 'Second output. '. "<br/> \ n"; flush (); // refresh the cache (directly sent to the browser) sleep (1);} echo 'output is complete! ';

The running effect is as follows:

Output 1st times.
Output 2nd times.
Output 3rd Times.
Output 4th times.
Output 5th times.
Output 6th times.
Output 7th times.
Output 8th times.
Output 9th times.
Output 10th times.
Output complete!

I hope this article will help you with php programming.

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.