Skip to content
This repository was archived by the owner on Jan 21, 2022. It is now read-only.

Commit 78e25dd

Browse files
committed
v2.1.0
1 parent 4f27291 commit 78e25dd

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

example/dist/loader.php

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
if (!isset($_GET['file'])) {
4+
exit();
5+
}
6+
7+
header("Content-type: text/css");
8+
9+
$lastModified_unix = filemtime($_GET['file']);
10+
$lastModified = gmdate("D, d M Y H:i:s \G\M\T", $lastModified_unix);
11+
$ifModifiedSince = false;
12+
13+
if (isset($_ENV['HTTP_IF_MODIFIED_SINCE'])) {
14+
$ifModifiedSince = strtotime(substr($_ENV['HTTP_IF_MODIFIED_SINCE'], 5));
15+
}
16+
17+
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
18+
$ifModifiedSince = strtotime(substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 5));
19+
}
20+
21+
if ($ifModifiedSince && $ifModifiedSince >= $lastModified_unix) {
22+
header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
23+
exit;
24+
}
25+
26+
if (isset($_GET['sleep'])) {
27+
sleep($_GET['sleep']);
28+
}
29+
30+
header('Last-Modified: '. $lastModified);
31+
32+
echo file_get_contents($_GET['file']);

0 commit comments

Comments
 (0)