Tom*_*sby 22 php cookies session session-timeout yii
我在下面列出了Yii配置文件的相关部分:
return array(
...
'components'=>array(
'session' => array(
'timeout' => 86400,
),
'user'=>array(
'allowAutoLogin' => true,
'autoRenewCookie' => true,
'authTimeout' => 31557600,
),
...
),
...
);
Run Code Online (Sandbox Code Playgroud)
我也进入了php.ini并设置session.gc_maxlifetime = 86400但是这仍然没有解决问题.
目前,我绝对不知道还有什么可能导致它超时并在大约15-30分钟不活动后将用户退出.理想情况下,用户应保持登录状态至少一天不活动(除了关闭浏览器窗口,允许浏览器首选项).
我已经拖网了谷歌,Yii和堆栈溢出,只是找不到我忽略的任何东西......但显然我忽略了一些东西.如果有人能帮助我,我会非常感激.
我们要求提供用于登录用户的典型代码示例,其中包含以下内容:
$identity = new UserIdentity('facebook', $id, $user->name, $user->email);
$loggedIn = Yii::app()->user->login($identity);
$this->subscriptionChecker->updateCurrentUserSubscribed();
Run Code Online (Sandbox Code Playgroud)
这在任何时候Yii::app()->user->login()被称为非常典型
在Chrome中,以下是我为该网站提供的Cookie及其到期日期(清除所有Cookie并仅登录后):
PHPSESSID expires When the browsing session ends
// I'm informed these are set by google analytics
__utma created Friday, 12 October 2012 14:05:31 expires Sunday, 12 October 2014 14:05:31
__utmb created Friday 12 October 2012 14:05:31 expires Friday 12 October 2012 14:35:31,
__utmc created Friday, 12 October 2012 14:05:31 expires When the browsing session ends
__utmz created Friday 12 October 2012 14:05:31 expires Saturday 13 April 2013 02:05:31
// end google analytics
Run Code Online (Sandbox Code Playgroud)
Tom*_*sby 15
http://www.yiiframework.com/doc/api/1.1/CWebUser#login-detail
感谢Arfeen的帮助,他指出了我正确的方向,除非你设置第二个参数,Yii::app()->user->login()结果是Yii不会使用持久性cookie,因为第二个参数默认为0.这个默认的0值会覆盖你可能做的任何其他事情.已经与超时有关.
| 归档时间: |
|
| 查看次数: |
29571 次 |
| 最近记录: |