Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Here I go what am doing is I am using

 Yii::app()->SESSION['userid']

with no

  Yii::app()->session->open();

at login

  Yii::app()->session->destroy();

at logout

I wanna know if dont do the open and destroy session is it worthy . Does Yii do it internally.

One more strange thing I dont know whats happening. In the same browser for a session I can login for multiple users .. this should not happen so.Is it that i am not using the open and destroy session methods .

 public function actionLogout()
{
    Yii::app()->user->logout();
    Yii::app()->session->clear();
    $this->redirect(Yii::app()->controller->module->returnLogoutUrl);
}

Please let me know how do i figure this out

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
196 views
Welcome To Ask or Share your Answers For Others

1 Answer

For creating yii session

Yii::app()->session['userid'] = "value";

You can get value like this

$sleep = Yii::app()->session['userid'];

And unset session like

unset(Yii::app()->session['userid']); # Remove the session

In case of user signs out , you have to remove all the session.

Yii::app()->session->clear();

After this, you need to remove actual data from server

Yii::app()->session->destroy();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...