我正在尝试在Yii中使用CDbHttpSession将会话数据存储到数据库中。但是,Yii似乎不存储信息,只是更新id。 这是一个完整的应用程序日志:
03:23:21.016446 trace system.db.CDbCommand
Querying SQL: SELECT *
FROM `YiiSession`
WHERE id=:id. Bound with :id='9m6bmlf12v4r9e7bleusv1rmp7'
in /YIIPATH/protected/models/LoginForm.php (29)
in
/YIIPATH/protected/controllers/SiteController.php
(115)
in /YIIPATH/index.php (13)
03:23:21.016472 profile system.db.CDbCommand.query
begin:system.db.CDbCommand.query(SELECT *
FROM `YiiSession`
WHERE id=:id. Bound with :id='9m6bmlf12v4r9e7bleusv1rmp7')
03:23:21.017136 profile system.db.CDbCommand.query
end:system.db.CDbCommand.query(SELECT *
FROM `YiiSession`
WHERE id=:id. Bound with :id='9m6bmlf12v4r9e7bleusv1rmp7')
03:23:21.017270 trace system.db.CDbCommand
Executing SQL: UPDATE `YiiSession` SET `id`=:id WHERE id=:oldID. Bound with
:oldID='9m6bmlf12v4r9e7bleusv1rmp7', :id='26h85kqrvrecd67kdf4riahca5'
in /YIIPATH/protected/models/LoginForm.php (29)
in
/YIIPATH/protected/controllers/SiteController.php
(115)
in /YIIPATH/index.php (13)
03:23:21.017291 profile system.db.CDbCommand.execute
begin:system.db.CDbCommand.execute(UPDATE `YiiSession` SET `id`=:id WHERE
id=:oldID. Bound with :oldID='9m6bmlf12v4r9e7bleusv1rmp7',
:id='26h85kqrvrecd67kdf4riahca5')
03:23:21.017766 profile system.db.CDbCommand.execute
end:system.db.CDbCommand.execute(UPDATE `YiiSession` SET `id`=:id WHERE
id=:oldID. Bound with :oldID='9m6bmlf12v4r9e7bleusv1rmp7',
:id='26h85kqrvrecd67kdf4riahca5')
非常感谢任何帮助。谢谢!
答案 0 :(得分:0)
所以我注意到如果您使用数据库进行会话存储,则必须在用户身份下设置持续时间,否则默认为0.如果有人也遇到此问题。