Reputation: 341
I need to set some values in session in yii2 project like employeeID employeeName and other? Where it would be suitable to work and get the session value so that access of those values will be easier?
Upvotes: 0
Views: 49
Reputation: 5032
Yii2 - Session and cookies - here you have full guide how to do it, but in most cases it's just:
GET from session in ANY place in your application:
Yii::$app->session->get('yourkey');
SET in session in ANY place in your application:
Yii::$app->session->set('yourkey, 'yourvalue');
And... that's all ;)
Upvotes: 1