Working With Output Handlers

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

string handler ( string $buffer , int $phase = ?)
buffer
Contents of the output buffer.
phase
Bitmask of PHP_OUTPUT_HANDLER_* constants .

警告

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.

注意: If the PHP_OUTPUT_HANDLER_DISABLED of a handler is set, the handler will not be invoked by calling ob_end_clean, ob_end_flush, ob_get_clean, ob_get_flush or during PHP's shutdown process. This flag has no effect on when calling ob_clean or ob_flush.

注意: 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.