ob_gzhandler
Description
The ob_gzhandler of zlib for PHP ob_start callback function to gzip output buffer.
Syntax
ob_gzhandler( string $data, int $flags ): string|false
Parameters
data
Contents of the output buffer.
flags
Bitmask of PHP_OUTPUT_HANDLER_* constants.
Value | Constant | Description |
---|---|---|
1 | PHP_OUTPUT_HANDLER_START | ouput buffer has started |
4 | PHP_OUTPUT_HANDLER_FLUSH | ouput buffer is being flushed |
8 | PHP_OUTPUT_HANDLER_FINAL | ouput buffer will be ended |
Return
Returns a string on success or false on failure.
Examples
1 · callback
<? $callback = "ob_gzhandler"; ob_start($callback); echo "output"; ?>
output
2 · handler
<? function myhandler($buffer, $phase) { return ob_gzhandler($buffer, $phase); } $callback = "myhandler"; ob_start($callback); echo "output"; ?>
output