Yii Sessions

I am trying to set the session id like this when logging in:

However the second row with the sessionId is not working. I’ve also tried to set it like CHttpSession::getSessionId() but that is not working either.

What am I missing here?

Hello,

You can use this code for session.

For store :




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

echo Yii::app()->session['var']; // Prints "value"



if u want to remove session :




Yii::app()->session->destroy(Yii::app()->session['var']);



No, this is not correct as this will remove ALL sessions.

Have you even tried it? Verify things before you post them here as solutions from now please.

The correct way to remove single variables is to use

unset(Yii::app()->session[‘variable’]);