The methods to save and obtain data in the yii2 framework session are as follows:
Save data
Yii::$app->session->set('user_exam', ['exam_id' => $exam_id, 'exam_type' => $exam_type]);
Get data
$this->user_exam = Yii::$app->session->get('user_exam');
Related recommendations :yii
The above is the detailed content of How to save and obtain data in yii2 framework. For more information, please follow other related articles on the PHP Chinese website!