请求缓存发送304

This commit is contained in:
thinkphp
2016-09-26 09:27:13 +08:00
parent f5f9fcfb92
commit 9b16b0c24b

View File

@@ -1487,7 +1487,9 @@ class Request
if (Cache::has($key)) {
// 读取缓存
$content = Cache::get($key);
$response = Response::create($content)->header('Content-Type', Cache::get($key . '_header'));
$response = Response::create($content)
->code(304)
->header('Content-Type', Cache::get($key . '_header'));
throw new \think\exception\HttpResponseException($response);
} else {
$this->cache = [$key, $expire];