23 public static function forFile($path, $content = null)
26 $headers[] =
"Content-Type: " . CFileHelper::getMimeTypeByExtension($path);
28 $headers[] =
"Content-Length: " . mb_strlen($content);
29 $contentPath = Yii::app()->getModule(
'contentSource')->getContentSource()->contentFile($path);
30 $headers[] =
"Last-Modified: " . gmdate(
"D, d M Y H:i:s", filemtime($contentPath)) .
" GMT";
45 $headers[] =
"Pragma: public";
46 $headers[] =
"Expires: " . date(
"r", time() + $seconds);
59 public static function cache($seconds = null)
63 $cache_string =
"Cache-Control: public";
65 if(isset($seconds) && is_numeric($seconds) && $seconds > 0) {
66 $cache_string =
"Cache-Control: max-age=".$seconds.
", public";
69 $headers[] = $cache_string;