PHP Manual

PHP function ob_start()

11. 09. 2019

Obsah článku

Availability in `PHP 4.0`

Turn on output buffering

Parameters

Parameter Data type Default value Note
$output_callback callback null, An optional output_callback function may be specified. This function takes a string as a parameter and should return a string. The function will be called when the output buffer is flushed (sent) or cleaned (with ob_flush, ob_clean or similar function) or when the output buffer is flushed to the browser at the end of the request. When output_callback is called, it will receive the contents of the output buffer as its parameter and is expected to return a new output buffer as a result, which will be sent to the browser. If the output_callback is not a callable function, this function will return false.
$chunk_size int null, If the optional parameter chunk_size is passed, the buffer will be flushed after any output call which causes the buffer's length to equal or exceed chunk_size. Default value 0 means that the function is called only in the end, other special value 1 sets chunk_size to 4096.
$erase bool null If the optional parameter erase is set to false, the buffer will not be deleted until the script finishes. This causes that flushing and cleaning functions would issue a notice and return false if called.

Return values

bool

Returns true on success, otherwise false on failure.

Other resources

Official ob-start documentation

Jan Barášek   Více o autorovi

Autor článku pracuje jako seniorní vývojář a software architekt v Praze. Navrhuje a spravuje velké webové aplikace, které znáte a používáte. Od roku 2009 nabral bohaté zkušenosti, které tímto webem předává dál.

Rád vám pomůžu:

Související články

1.

V jiných jazycích

2.
Status:
All systems normal.
2024