Answer the question
In order to leave comments, you need to log in
Is it possible to set up Last-Modified in yii2?
Welcome all. Can you please tell me how to set lastmod headers in yii2?
Will it be necessary to run through the database, tracking changes in all records that are displayed on the page and look at the date the file structure of the views was changed (including nested ones)? Or is there some other solution?
Answer the question
In order to leave comments, you need to log in
The documentation even has an example from a controller:
public function behaviors()
{
return [
[
'class' => 'yii\filters\HttpCache',
'only' => ['index'],
'lastModified' => function ($action, $params) {
$q = new \yii\db\Query();
return $q->from('post')->max('updated_at');
},
],
];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question