Home  >  Article  >  Backend Development  >  How to clear buffer in php

How to clear buffer in php

藏色散人
藏色散人Original
2020-08-18 10:12:043047browse

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.

How to clear buffer in php

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn