mirror of
https://github.com/mrclay/minify.git
synced 2025-03-13 08:59:38 +01:00
36 lines
992 B
PHP
36 lines
992 B
PHP
<?php
|
|
|
|
require __DIR__ . '/../../bootstrap.php';
|
|
|
|
// emulate regularly updating document
|
|
$every = 20;
|
|
$lastModified = round(time()/$every)*$every - $every;
|
|
|
|
$cg = new HTTP_ConditionalGet(array(
|
|
'lastModifiedTime' => $lastModified
|
|
));
|
|
$cg->sendHeaders();
|
|
if ($cg->cacheIsValid) {
|
|
// we're done
|
|
exit();
|
|
}
|
|
|
|
$title = 'Last-Modified is known : simple usage';
|
|
$explain = '
|
|
<p>If your content has not changed since a certain timestamp, set this via the
|
|
the <code>lastModifiedTime</code> array key when instantiating HTTP_ConditionalGet.
|
|
You can immediately call the method <code>sendHeaders()</code> to set the
|
|
Last-Modified, ETag, and Cache-Control headers. The, if <code>cacheIsValid</code>
|
|
property is false, you echo the content.</p>
|
|
<p>This script emulates a document that changes every ' .$every. ' seconds.
|
|
<br>This is version: ' . date('r', $lastModified) . '</p>
|
|
';
|
|
|
|
require '_include.php';
|
|
|
|
send_slowly(get_content(array(
|
|
'title' => $title
|
|
,'explain' => $explain
|
|
)));
|
|
|