php ob caching mechanism

If you turn ob_start (), all echo output will be saved to the cache ob, ob series of function can be used to operate, and if not, by default, at the end of program execution, the cache data will be sent to the browser

 

ob is output_buffer (output buffer) shorthand. In the process the browser requests a page in php, it has gone through three cache

  1, ob cache

  2, program cache

  3, browser cache

ob cache used functions

ob_clean (); // clear the cache 
ob_start () open the cache
ob_get_contents () Gets the cached content among the
ob_end () turn off caching
ob_end_clean () Clear and turn off caching 
ob_end_flush () // ob the contents of the cache, the cache is flushed to the program, and closes the ob ob_flush () to refresh the buffer contents into the procedure cache, the default program it is executing the program and then put the contents of the cache among // ob cache, the cache is flushed to the program, but does not close the ob flush () the program cache content pushed to the browser Note that; Still other versions of IE, only after they have received 256 bytes began to display the page, it is necessary to send some extra spaces to get those browsers to display the page. ] Normally if you do not open ob cache only waiting for the program to complete before the buffer content into the program and push to the top browser

 

Guess you like

Origin www.cnblogs.com/webcyh/p/11727990.html