Home > Backend Development > PHP Problem > How to clear buffer in php

How to clear buffer in php

藏色散人
Release: 2023-03-04 17:22:02
Original
3098 people have browsed it

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
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template