The difference between flush (), Ob_flush (), Ob_end_flush ():
First, the next buffer, it is a memory address space, for 4096 (1KB) "found in the php.ini configuration file output_buffering Configuration", PHP has a php output_buffering mechanism, PHP code in the execution of the time, Not immediately the content output, but want to output echo/print content to buffer,buffer full when the data will be handed to the system kernel to TCP to the browser display, when the PHP php output_buffering mechanism (the default is open, Can be turned on by the Ob_start () function, the data in buffer will be sent to the browser only if the data in the PHP buffer reaches the set value.
But the browser also has a cache, some version of the browse when the data reaches 256 bytes of time to output content, flush () can wait for the output of the content to be sent immediately to the client, and Ob_flush () only wait until the buffer full time to output.
Here's a simple example for you to verify:
Copy the Code code as follows:
Prevent browser caching
echo str_repeat ("", 1024);
for ($i =0; $i <5; $i + +) {
echo $i;
Sleep (1);
Flush ();//will output a number every 1s, if using ob_flush () will wait for 5s output together
}
?>
http://www.bkjia.com/PHPjc/326610.html www.bkjia.com true http://www.bkjia.com/PHPjc/326610.html techarticle the difference between flush (), Ob_flush (), Ob_end_flush (): First, say buffer, it is a memory address space, for 4096 (1KB) "In the php.ini configuration file found output_buffering match ...