Note: Ob_flush () and flush () These two functions are generally used together, in order to Ob_flush () first, then flush (), and their function is to flush the buffer. Here's a specific next time to use the flush buffer and why to flush the buffer. Note: the Ob_flush () and flush () functions are generally used together, in order to Ob_flush () first, then flush (), and their function is to flush the buffer. Here's a specific next time to use the flush buffer and why to flush the buffer. First, when to flush buffers when using the file_get_contents () and File_put_contens () functions in a program, or to perform a similar "read and write" in a program function or perform an output operation to the browser, Ob_flush () and flush () are used to flush the buffer. Second, why to flush the buffer use file_get_contents () and File_put_content () as an example to explain. The file_get_contents () and file_put_conents () functions perform both read and write data operations, where the data is read into memory and then written to the file, because the read speed is faster than the write, So when your data is read, it does not mean that the data is written, this time the content will be temporarily put into the buffer (memory), where it needs to be emphasized, in fact, the data read and write is two very fast action oh. Also uses an explanation (when the program performs output operations to the browser), and individual Web server programs, especially Web server programs under Win32, still cache the output of the script until the end of the program, before sending the results to the browser. You can also use Ob_flush () and flush () to flush the cache if you do not want the program to complete before you print it out. In fact, flush () also has a purpose, that is, before the end of the program before the output, that is, a loop is not finished to output some of the results to the browser, this effect is similar to Ajax asynchronous transmission effect. |