PHP Cache use details _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
PHP Cache zone usage details .? Phpfor ($ i0; $ i10; $ I) {ob_start (); echoThisisiteration $ I:; * Dontdothis! $ Bufob_get_contents (); ob_clean (); * Usethisinstead: $ bufob_get_flush (); For ($ I = 0; $ I <10; $ I ){
Ob_start ();
Echo "This is iteration $ I :";
// * Dont do this!
// $ Buf = ob_get_contents ();
// Ob_clean ();
// * Use this instead:
$ Buf = ob_get_flush ();
// The buffer is closed and there is still content.
$ Test = ob_get_contents ();
Echo $ test, ---->;
Echo $ buf;
Echo memory_get_usage ()."";
Echo
;
}
?>

For ($ I = 0; $ I <10; $ I ){
Ob_start ();
Echo "This is iteration $ I :";
// * Dont do this!
// $ Buf = ob_get_contents ();
// Ob_clean ();
// * Use this instead:
$ Buf = ob_get_flush ();
// When the buffer is closed, there is still content
$ Test = ob_get_contents ();
Echo $ test, ---->;
Echo $ buf;
Echo memory_get_usage ()."";
Echo
;
}
?>

Ob_get_flush is equivalent to ob_end_flush. there is only one difference. ob_get_flush gets the content of the cache, stores it in the variable, and closes the cache.

Http://www.bkjia.com/PHPjc/486045.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/486045.htmlTechArticle? Php for ($ I = 0; $ i10; $ I) {ob_start (); echo "This is iteration $ I:"; // * Dont do this! // $ Buf = ob_get_contents (); // ob_clean (); // * Use this instead: $ buf = ob_get_flush ();...

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.