D
D
Darklt2021-07-29 10:58:57
Yii
Darklt, 2021-07-29 10:58:57

What is the path of the yii controller?

Tell me where to insert the last-modified header?

public function behaviors() {
    return [
        'HttpCache' => [
            'class' => 'yii\filters\HttpCache',
            'lastModified' => function ($action, $params) {

                $model = \app\models\Products::findOne($_GET['id']);
                $time = (empty($model->time_edit))?$model->time_add:$model->time_edit;

                return $time;
            },
        ],
    ];
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question