Ob_start () tutorial & lt ;? Phpob_start (); --------------------------- 1for ($ s0; $ s & lt; 300; $ s ++) {echo;} ob_end_clean (); then 2for ($ var0; $ var & lt ob_start () tutorial
Ob_start (); // ------------------------------- 1
// For ($ s = 0; $ s <= 300; $ s ++) {echo '';}
// Ob_end_clean (); // -------------------------------------- 2
For ($ var = 0; $ var <= 10; $ var ++ ){
Echo $ var;
Print str_repeat ("", 4096 );
Ob_flush (); // -------------------------- 3
Flush (); // -------------------------- 4
Sleep (1); // -------------------------- 5
}
?>
An example of a buffer test is displayed. when the ob_start () function is used, [3] releases the buffer content and [4] sends the content no longer in the buffer to the page, [5] The message is sent once per second, but why does it wait 10 seconds before sending all the content.
I checked a lot of articles and many said that I used the method at [2] to comment out [1] [3], but in this way I disabled the buffer zone,
The Php statement on the Internet is called an internal buffer or a buffer. I don't know if it is a thing.
Is the output_buffering buffer in the Php. ini file enabled by ob_start?
------ Solution --------------------
Ob_flush is not very useful. please refer to the official documentation.
Http://il.php.net/manual/en/function.ob-flush.php
Some problems with ob_flush () and flush () cocould be resolved by defining content type header:
Header ('content-type: text/html; charset = utf-8 ');
So working code looks like this:
Header ('content-type: text/html; charset = utf-8 ');
Echo 'In in...
';
For ($ I = 0; $ I <10; $ I ++)
{
Echo $ I .'
';
Flush ();
Ob_flush ();
Sleep (1 );
}
Echo 'end...
';
?>