首頁  >  文章  >  php框架  >  yii2框架中怎麼保存和獲取數據

yii2框架中怎麼保存和獲取數據

王林
王林轉載
2020-12-01 15:26:102287瀏覽

yii2框架中怎麼保存和獲取數據

yii2框架session中儲存和取得資料的方法如下:

#儲存資料

Yii::$app->session->set('user_exam', ['exam_id' => $exam_id, 'exam_type' => $exam_type]);

取得資料

$this->user_exam = Yii::$app->session->get('user_exam');

相關推薦:yii

#

以上是yii2框架中怎麼保存和獲取數據的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:csdn.net。如有侵權,請聯絡admin@php.cn刪除