update page now
PHP 8.5.6 Released!

Voting

: eight plus one?
(Example: nine)

The Note You're Voting On

thecichos at gmail dot com
2 years ago
The output buffer seems to work best when the server is returning a code 206 and setting the output_buffering lower temporarily to let it fill up

This tells the browser to wait for additional content
for example:
// Set the header to 206
header("HTTP/1.1 206 Partial Content; Content-Type: text/html; charset=utf-8");

// Flush the current outputbuffer
flush();
ob_flush();
ob_end_flush();
            
// Create a new output buffer
ob_start();

// Save the current output buffer size
$tempBuffering = ini_get("output_buffering");
            
// Set a new, much smaller buffer size
ini_set("output_buffering", 256);

// Do some buffering 
!!!   All your amazing code goes here   !!!

// Fill the buffer with something if needed
echo str_pad(" ", (int)ini_get("output_buffering"), " ");
flush();
ob_flush();

// Revert the buffer size
ini_set("output_buffering", $tempBuffering);

<< Back to user notes page

To Top