Ben PHP önbelleğe alma için doğru HTTP Başlıkları olduğunu düşünüyorum ve her saniye istek üzerine bir 500 hatası alıyorum ne kuruyorum.
Herkes bana doğru yönde işaret edebilir?
Önbelleğe yapıyor kodu:
<?php
header('Content-Type: text/css');
$content = file_get_contents('test.css');
header('Content-Length: '. strlen($content ));
$expires = 3600;
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
// Split the If-Modified-Since (Netscape < v6 gets this wrong)
$modifiedSince = explode(';', $_SERVER['HTTP_IF_MODIFIED_SINCE']);
// Turn the client request If-Modified-Since into a timestamp
$modifiedSince = strtotime($modifiedSince[0]);
$current_time = time();
if (($current_time - $modifiedSince) < $expires) {
header("304 Not Modified");
//echo $current_time - $modifiedSince;
exit();
}
}
$current_time = time();
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $current_time)." GMT");
header("Expires: " . gmdate("D, d M Y H:i:s", $current_time+$expires) . " GMT");
header("Cache-Control: max-age=$expires");
echo $content;
Teşekkürler
Edit 1: Ben hiçbir sevinç ile benim önbelleğini temizleyin ve birisi onlar için çalışma raporları. Bu bir sunucu yapılandırma sorunu anlamına geliyor? Bu konularda, barındırılan bir sunucu üzerinde bulunuyor.
Edit 2: IE gerçekleşmesi değil gibi görünüyor, ama Firefox oluyor