Hi, is there any tutorial on how to create and manage sessions, stored in DB, using Yii? I’ve read manual and reference but, sorry, it’s not too clear for me
TIA
Danilo
Hi, is there any tutorial on how to create and manage sessions, stored in DB, using Yii? I’ve read manual and reference but, sorry, it’s not too clear for me
TIA
Danilo
You just need to add following code to the config file:
session'=>array(
'class' => 'CDbHttpSession',
'connectionID' => 'db',
'sessionTableName' => 'dbsession',
),
Database table will be created automatically.
Yes, thanks. This part is clear. What it’s not clear to me, it’s how to use session on controller, how to create, or check, or modify ofr example… for this reason I’m looking for a tutorial.
You can use Yii::app()->session object. It can be used as array, for example, $value = Yii::app()->session[‘name’] or Yii::app()->session[‘name’] = $value. Also you can look Class Reference.