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 ();...