您好,欢迎访问一九零五行业门户网

php巧用304代码缓存图片文件

private function _addetag($file) { $last_modified_time = filemtime($file); $etag = md5_file($file); // always send headers header(last-modified: .gmdate(d, d m y h:i:s, $last_modified_time). gmt); header(etag: $etag); // exit if not modified if (@strtotime($_server['http_if_modified_since']) == $last_modified_time || @trim($_server['http_if_none_match']) == $etag) { header(http/1.1 304 not modified); exit; }}
复制代码
在静态文件(如图片)输出之前调用即可。
其它类似信息

推荐信息