会话超时不起作用+ cakephp

编程入门 行业动态 更新时间:2024-10-27 10:33:13
本文介绍了会话超时不起作用+ cakephp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想将会话超时时间增加到24小时左右,为此我进行了网上搜索,但没有任何帮助。 目前,我的网站在此过期后会进行大约40分钟的会话,我希望将其设置为24小时。 在我的core.php中,添加了以下几行

I want to increase my session timeout to around 24 hours and for this I searched net but nothing helped me out. presently my website make the session of around 40 mins after this is expires i want to make this to 24 hours. In my core.php I added these lines

Configure::write('Session.timeout', '864'); // Session will last 24h Configure::write('Session.autoRegenerate',true); Configure::write('Security.level', 'medium');

任何想法或建议。

推荐答案

CakeSession配置参数的命名令人困惑,并且设置它们并不总是一致的(例如,参见下文)。

The naming of the CakeSession config parameters is confusing and setting them is not always consistent (see below for example).

1) Configure :: write('Session.timeout','XXX'); 是会话持续的分钟分钟数。因此,如果要持续24小时,请将其设置为24 * 60。

1) Configure::write('Session.timeout', 'XXX'); is the number of minutes session will last. So if you want it to last 24 hours, set it to 24*60.

2) Configure :: write('Session.autoRegenerate' ,true); 未链接到'Session.timeout'-即使Cake文档暗示了此链接。 autoRegenerate 取决于 CakeSession :: $ requestCountdown 值。 $ requestCountdown 是重新生成会话ID之前的综合浏览量。它不是基于时间的。

2) Configure::write('Session.autoRegenerate',true); is not linked to 'Session.timeout' -- even though the Cake docs implies it is. autoRegenerate is dependent on the CakeSession::$requestCountdown value. $requestCountdown is the number of pageviews before the session ID is regenerated. It is NOT time-based.

因此出现了不一致:我们如何设置 CakeSession :: $ requestCountdown 值?我们处理其他参数的方式不同。您必须通过以下方式在引导程序中进行设置:

So here comes the inconsistency: how do we set the CakeSession::$requestCountdown value? Not the same way we do the other params. You have to set it in bootstrap via:

App::uses('CakeSession', 'Model/Datasource'); CakeSession::$requestCountdown = 25;

不能像其他参数一样通过Configure来设置此值(自v2.4起)。请参阅我为此打开的票证,确认上面的内容是预期的用法: github。 com / cakephp / cakephp / issues / 2078

This value can NOT be set via Configure like the other params (as of v2.4). See the ticket I opened on this that confirms that the above is the intended usage: github/cakephp/cakephp/issues/2078

3) Configure :: write('Security.level','?? ???'); 自Cake 2.0起已删除。

3) Configure::write('Security.level', '?????'); has been removed since Cake 2.0.

ref: book.cakephp/2.0/en/development/sessions.html

更多推荐

会话超时不起作用+ cakephp

本文发布于:2023-05-31 12:02:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/391382.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   cakephp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!