简体   繁体   English

会话在yii2中销毁

[英]Session destroy in yii2

I want login page whenever Yii2 project open in browser.

让我知道当系统关闭电源时,我们需要采取哪些步骤来破坏会话。

You should set enableAutoLogin to false in your config file. 您应该在配置文件中将enableAutoLogin设置为false This setting is false by default but the basic and advanced Yii2 template both set this value to true. 默认情况下,此设置为false,但是基本和高级Yii2模板均将此值设置为true。

When it is false the cookie that will be created for the login will not be used to authenticate the user when 'first' coming on the page and so the login page will be displayed. 如果为false,则在页面上“第一个”出现时,将不会使用为登录创建的cookie来对用户进行身份验证,因此将显示登录页面。

The docs: 该文档:

http://www.yiiframework.com/doc-2.0/yii-web-user.html# $enableAutoLogin-detail http://www.yiiframework.com/doc-2.0/yii-web-user.html# $ enableAutoLogin-detail

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM