無法緩存,返回碼一直是200
public function behaviors()
{
return [
? //使用http緩存
? [
? ? ? 'class'=>'yii\filters\HttpCache',
? ? ? 'lastModified'=>function(){
? ? ? //這是一個時間戳
? ? ? //只要時間戳一致,那么就可以認為緩存一致,響應一致
? ? ? ? ?return 1432817566;
? ? ? }
? ]
];
}
public function actionIndex()
{
//echo "4";
return $this->renderPartial('index');
}
2016-12-10
換個瀏覽器試試,或者看下chrome的設置有沒有禁用緩存
2022-03-29