I am trying to set some session variable in Yii using the following code :
$session=new CHttpSession;
$session->open() ;
$session->setSessionName('My Session') ;
$session['sleep'] = 0 ;
$session['attempts'] = 0 ;
$session->writeSession('sleep','0') ;
$session['ip'] = $this->get_ip_address() ; $session->close() ; var_dump($session,$session['ip']) ;
However , I am not able to set the session vaiables above , the dump has the following result :
object(CHttpSession)#17 (5) { ["autoStart"]=> bool(true) ["behaviors"]=> array(0) { } ["_initialized":"CApplicationComponent":private]=> bool(false) ["_e":"CComponent":private]=> NULL ["_m":"CComponent":private]=> NULL } string(3) "::1"
It sees $session and $session['ip'] as two completely different variables . Can someone help me out with this ?