Strange session behavior

If you do nothing, the session does not work either in the view or in the controller (public function actionTest ()), but if you write Yii :: app () -> getSession (); The controller does not work, help, please!

Session config:

'session' => array ( 'sessionName' => 'PHPSESSID', 'class'=> 'CDbHttpSession', // 'autoCreateSessionTable '=> 'true' , 'connectionID' => 'db', 'sessionTableName' => 'SessionTable', 'useTransparentSessionID' =>($_POST['PHPSESSID']) ? true : false, 'cookieMode' => 'allow', 'timeout' => 300 ) 
  • it's not clear how you use it .. Yii :: app () -> getSession (); returns CDbHttpSession with it and working - VasyOk
  • I try first $ _SESSION ['test'] = 'XXXX'; then delete and print print_r ($ _ SESSION); - Costa
  • one
    Forget about $ _SESSION, your framework works well with sessions and use it. - VasyOk
  • Tell me, please, what is the error, do the same thing, only instead of $ _SESSION I use Yii :: app () -> session; And still does not work. - Costa

1 answer 1

Save to session

 Yii::app()->session->add("test", $test); 

Get out of session

  $test = Yii::app()->session->get("test"); 

In the config you have indicated storage in the database in the SessionTable table. Check if session is being saved there.