bilalahmad
(Sheikh Mrbilal)
January 6, 2014, 6:14pm
1
hi everyone,
hope you are best of health. I am new in yii. i want to create a user session when user logged in he can acess only his data. like if admin login only admin can access their data and if another user is logged in he can access only their data. how can i do this. hopefully anyone help me.
thank you
Hmm, seems like this topic is not covered in the docs.
Ok, we have two functions:
public function get($key, $defaultValue = null)
public function set($key, $value)
So you can do something like this:
\Yii::$app->session->set('myVar', 'myValue');
and then
\Yii::$app->session->get('myVar');
or
\Yii::$app->session->get('myVar', 'defaultValue');
samdark
(Alexander Makarov)
January 6, 2014, 11:56pm
3
bilalahmad
(Sheikh Mrbilal)
January 7, 2014, 6:53am
4
Hmm, seems like this topic is not covered in the docs.
Ok, we have two functions:
public function get($key, $defaultValue = null)
public function set($key, $value)
So you can do something like this:
\Yii::$app->session->set('myVar', 'myValue');
and then
\Yii::$app->session->get('myVar');
or
\Yii::$app->session->get('myVar', 'defaultValue');
Thanks for reply Orey but i am using yii 1.1 version how to do in this version of yii.
samdark
(Alexander Makarov)
January 7, 2014, 9:35am
5
Why you’ve posted in 2.0 forum then? Topic moved.