PHP: Working With Output Handlers - Manual (original) (raw)

Change language:

When invoked, output handlers are passed the contents of the buffer and a bitmask indicating the status of output buffering.

handler ( string $buffer , int $phase = ?): string

buffer

Contents of the output buffer.

phase

Bitmask of [PHP_OUTPUT_HANDLER_*](outcontrol.constants.php#constant.php-output-handler-start) constants .

Warning

Calling any of the following functions from within an output handler will result in a fatal error:ob_clean(), ob_end_clean(),ob_end_flush(), ob_flush(),ob_get_clean(), ob_get_flush(),ob_start().

Note: If the [PHP_OUTPUT_HANDLER_DISABLED](outcontrol.constants.php#constant.php-output-handler-disabled) of a handler is set, the handler will not be invoked by callingob_end_clean(), ob_end_flush(),ob_get_clean(), ob_get_flush(),ob_clean(),ob_flush() or during PHP's shutdown process. Prior to PHP 8.4.0, this flag had no effect when calling ob_clean() or ob_flush().

Note: The working directory of the script can change inside the shutdown function under some web servers, e.g. Apache or the built-in web server.

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug

+add a note

User Contributed Notes

There are no user contributed notes for this page.