CakePHP会话不断重置 [英] CakePHP Session keeps getting reset
问题描述
我通过ajax调用设置一个Session变量。我试过两个使用帮助程序和使用直接的PHP $ _SESSION语法。由于某种原因,每当我重新载入网页时,所有SESSION资料都会消失。
I'm setting a Session variable with an ajax call. I've tried both by using the helper and by using the straight PHP $_SESSION syntax. For some reason, whenever I reload the page, all SESSION data is gone.
这是令人烦恼的是,它偶尔发生。我想首先,它与我使用的浏览器,但它不是。我尝试更改core.php中的所有会话设置,没有组合似乎是可靠的。
What is annoying about this, is that it happens sporadically. I thought at first, it had to do with the browser I was using, but it does not. I have tried changing all the Session settings in core.php and no combination seems to be reliable.
有关如何解决这个问题的任何想法?
Any thoughts as to how I can fix this problem?
推荐答案
您将需要打开 app / config / core.php
文件修改 Security.level
部分。从手册:
You'll want to open the app/config/core.php
file and modify the Security.level
section. From the manual:
Security.level
CakePHP安全级别。
'Session.timeout'中定义的
会话超时时间根据此处的设置乘以
。
The level of CakePHP security. The session timeout time defined in 'Session.timeout' is multiplied according to the settings here.
有效值: high'= x 10'medium'=
x 100'low'= x 300
Valid values: 'high' = x 10 'medium' = x 100 'low' = x 300
'high'和'medium'也启用
session.referer_check
'high' and 'medium' also enable session.referer_check
如果
'Security.level'设置为'high',CakePHP会话ID也会在请求之间重新生成
。
CakePHP session IDs are also regenerated between requests if 'Security.level' is set to 'high'.
在 Security.level
中搜索 core.php
文件,设置为低
,并确保 Session.timeout
的值足够高。您可能需要同时播放这两项设置,直到满意为止。
Search the core.php
file for Security.level
and change the setting to low
and ensure you Session.timeout
value is high enough. You may have to play with both of these settings until your satisfied.
这篇关于CakePHP会话不断重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!