Yii2 中的 authTimeout [英] authTimeout in Yii2

查看:43
本文介绍了Yii2 中的 authTimeout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在用户闲置固定秒后自动在 yii2 中注销.在 web.php 我添加了

I am trying to log out user automatically in yii2 after he is idle for a fixed seconds . In web.php I added

'user' => [
            'identityClass' => 'app\models\User',
            'enableAutoLogin' => true,
            'authTimeout'=>100
        ],

components 内部.我正在使用基本模板.但它不会自动注销.这在 Yii2 中有效吗?我正在关注 http://www.yiiframework.com/doc-2.0/yii-web-user.html

inside components . I am using basic template. But it is not logging out automatically. Does this work in Yii2? I was following documentation from http://www.yiiframework.com/doc-2.0/yii-web-user.html

推荐答案

$authTimeout - 公共属性.

如果用户保持不活动状态,他将自动退出的秒数.如果没有设置这个属性,用户将在当前会话过期后注销(参见 yii\web\Session::$timeout).

The number of seconds in which the user will be logged out automatically if he remains inactive. If this property is not set, the user will be logged out after the current session expires (c.f. yii\web\Session::$timeout).

请注意,如果 $enableAutoLogintrue,这将不起作用.

Note that this will not work if $enableAutoLogin is true.

这篇关于Yii2 中的 authTimeout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆