This article mainly introduces PHP Ob_flush function and flush function usage, the example analyzes the function of Ob_flush function and flush function and related use skill, has certain reference value, the need friend can refer to the next
This paper analyzes the usage of Ob_flush function and flush function in PHP. Share to everyone for your reference. Specific as follows:
Ob_flush () function: Take out the data in PHP buffering and put it into the server buffering
Flush () Function: Remove the data from the server buffering and put it into browser buffering
For example, code:
<?php Echo str_repeat (' m0sh1 ', +); for ($i =0; $i <4; $i + +) { echo $i. ' <br/> '; Ob_flush (); Flush (); Sleep (1); } ?> <?php//header ("content-type:text/html;charset= ' Utf-8 '"); Hint error cannot modify header Information-headers already sent by?>
Perform discovery
Here the code output is one line of output,
Note: The order in which they are used correctly is. Ob_flush first, then flush.