This page loads HTML content in two chunks, with the first chunk loading quickly and the second one slowly.
This is made possible by the output buffering APIs in PHP. You can find out more about those APIs in the PHP Manual's section "Output Buffering Control".
Specifically, the ob_start
function is used to start buffering the output, and
ob_get_clean
is used to retrieve the buffer contents and stop buffering.
After all the output has been collected in memory, the total content size is calculated and sent in the HTTP headers.
Then, the chunks are sent to the client using the ob_flush
and flush
functions, with
a 1 second delay between each chunk.
The header X-Accel-Buffering: no
is used to disable buffering in the nginx web server.