修改CakePHP会话的会话Cookie到期和会话超时 [英] Modify session cookie expiry and session timeout for a CakePHP session

查看:333
本文介绍了修改CakePHP会话的会话Cookie到期和会话超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力完成以下操作:
根据用户的类型更改用户的会话Cookie到期日期。

I'm struggling to accomplish the following: Alter the user's session cookie expiry date based on the user's type.

我有一个CakePHP Web应用程序其中我使用CakePHP会话创建了我的身份验证组件(而不是CakePHP的Auth)。我已经配置CakePHP使用数据库处理会话。

I have a CakePHP web application wherein I have created my authentication component (instead of CakePHP's Auth) using CakePHP sessions. I've configured CakePHP to handle sessions using the database.

以下是我在config.php中的相关配置设置:

Here are the relevant configuration settings that I have in my config.php:

Configure::write('Session.save', 'database');
Configure::write('Session.timeout', '36');
Configure::write('Security.level', 'medium');

如何扩展会话cookie到期日期,并更新expires

How do I extend the session cookie expiry date AND update the value in the "expires" column in the "sessions" table?

推荐答案

查找 $ c> app / config / core.php

Find this: app/config/core.php

将此行更改为所需的值(分钟):

配置:: write('Session.timeout','120');

Change this line to your desired value in minutes:
Configure::write('Session.timeout', '120');

(自CakePHP 2.3.0 Security.level 不再使用。

更改日志: http://cakephp.org/changelogs/2.3.0

(Since CakePHP 2.3.0 Security.level is no longer used.
Changelog: http://cakephp.org/changelogs/2.3.0)

这篇关于修改CakePHP会话的会话Cookie到期和会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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