Home > Article > Backend Development > How to clear buffer in php
In PHP, you can clear the output buffer through the "ob_clean" function. The syntax of this function is "ob_clean (void): void". This function is used to discard the contents of the output buffer, but it will not be used like The output buffer is destroyed like the "ob_end_clean" function.
Recommended: "PHP Video Tutorial"
php clear buffer
ob_clean
(PHP 4 >= 4.2.0, PHP 5, PHP 7)
ob_clean — Clear (erase) the output buffer
Description
ob_clean ( void ) : void
This function is used to discard the contents of the output buffer.
This function does not destroy the output buffer like the ob_end_clean() function.
Output buffering must have been started by ob_start() with the PHP_OUTPUT_HANDLER_CLEANABLE flag. Otherwise ob_clean() will have no effect.
Return value
No return value.
Note:
ob_flush() - flush out (send out) the contents of the output buffer
ob_end_flush() - flush out (send out) the output buffer content and close the buffer
ob_end_clean() - clear (erase) the buffer and close the output buffer
The above is the detailed content of How to clear buffer in php. For more information, please follow other related articles on the PHP Chinese website!