Cakephp会话在重定向后被销毁 [英] Cakephp session is destroyed after redirect

查看:191
本文介绍了Cakephp会话在重定向后被销毁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在我的本地计算机上安装一个MAMP,测试一个Facebook应用程序。我怀疑它可能是我的MAMP配置。

I'm currently on a MAMP install on my local machine testing a facebook application. I suspect it is probably my MAMP configuration.

在蛋糕php in / user / login我使用

In cake php in /user/login I set a session using

$this->Session->write('Facebook.last_name',$user_profile['last_name']);
$this->redirect('/users/add');

然后在/ users / add中我尝试访问所有会话信息

then in /users/add I try and access all session informtaion

print_r ($this->Session->read());

但是,返回的唯一会话信息是以下而不是我设置的。

However the only session information that is returned is the following and not what I set.


Array([Config] => Array([userAgent] => 87a1f39ea78f3ab90174ff791710e6dc [time] => 1345915176 [countdown] => 10))

Array ( [Config] => Array ( [userAgent] => 87a1f39ea78f3ab90174ff791710e6dc [time] => 1345915176 [countdown] => 10 ))


推荐答案

这可能是您的工作阶段甚至没有储存。

It may be that your session is not even being saved.

当您写入会话时,您会得到什么,然后立即调试它?

What do you get when you write to the session then immediately debug it?

$this->Session->write('Facebook.last_name',$user_profile['last_name']);
debug($this->Session->read());
exit;

检查您的core.php文件以及保存会话变量的位置。
我认为它是在config / core.php

Check your core.php file for where your session variable is being saved as well. I think it is arround line 136 in the config/core.php

这篇关于Cakephp会话在重定向后被销毁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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