mirror of
https://github.com/seigler/simple-php-buffering
synced 2025-07-25 08:46:13 +00:00
No description
.gitignore | ||
buffer.php | ||
LICENSE.txt | ||
README.md |
seigler/simple-php-buffer
PHP file for basic file-based output buffering
Usage
define('CACHE_PATH', sys_get_temp_dir().'/cache_'); // optional, cache-file location prefix
define('CACHE_TIME', 5 * 60); // optional, seconds to cache the output
require 'buffer.php';
This will send last-modified
, expires
, and etag
headers. If a request includes etag
and
modified-since
headers the script can intelligently return a 304 not modified.
This uses output buffering, but it can't buffer headers. If you need to send out a header every time, cached or not, put that header code above the require
.
Header('Content-type: image/svg+xml; charset=utf-8');
Header('Content-Disposition: inline; filename="fancy-chart-' . date('Y-m-d\THisT') . '.svg"');
require 'buffer.php';
// remaining code to generate the chart