1、代码设置:(注释方式)useSensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
/**@Cache(smaxage="3600",maxage="3600",public=true)*/(手动方式)$cacheTime=3600;$response=newJsonResponse($channelDatas,200);$response->setPublic()->setMaxAge($cacheTime)->setSharedMaxAge($cacheTime);2、nginx配置location~\.php($|/){includefastcgi_params;fastcgi_pass127.0.0.1:9000;fastcgi_cachefastcgicache;//必须加上}
如果觉得《缓存 Cache-Control:max-age symfony》对你有帮助,请点赞、收藏,并留下你的观点哦!