Brief introduction
When the PHP script has output, the output control function can use these to control the output. This is useful in a number of different situations, especially when the script begins to output data and sends an HTTP header message to the browser. The output control function does not affect the header information sent by the header () or Setcookie (), only affects functions such as echo and the data between PHP blocks.
Attention:
Due to the previous version of the defect, when upgrading from php4.1.x (4.2.x,4.3.x), you must ensure that the Implicit_flush in php.ini is off, otherwise any output with Ob_start () will be hidden in the output.
Basic usage
<?php Ob_start (); echo "hello\n"; Setcookie ("CookieName", "Cookiedata"); Ob_end_flush ();? >
In the above example, the output of the Echo function is kept in the output buffer until Ob_end_flush () is called. Also, the call to Setcookie () successfully stores a cookie without causing an error. (Normally, after the data is sent to the browser, it is no longer possible to send HTTP header information.) )
Output control function
flush-Refresh Output buffering
ob_clean-Empty (erase) the output buffer
ob_end_clean-Empty (Erase) buffer and turn off output buffering
ob_end_flush-flushes out (sends out) the output buffer content and turns off buffering
ob_flush-Flushing out (sending out) the contents of the output buffer
Ob_get_clean-gets the contents of the current buffer and deletes the current output ease.
ob_get_contents-returns the contents of the output buffer
ob_get_flush-brushes out (sends out) buffer content, returns content as a string, and closes the output buffer.
ob_get_length-returns the length of the output buffer content
ob_get_level-returns the nesting level of the output buffering mechanism
ob_get_status-get the status of all output buffers
Ob_gzhandler-the callback function used in Ob_start to compress the contents of the output buffer.
ob_implicit_flush-turn on/off absolute swipe
ob_list_handlers-lists all the output handlers in use.
ob_start-Open Output Control buffer
output_add_rewrite_var-Add the value of the URL rewrite (add URL rewriter values)
output_reset_rewrite_vars-resetting the value of the URL rewrite (reset URL rewriter values)