【发布时间】:2013-03-04 20:03:31
【问题描述】:
我在 cakephp 应用程序中使用会话,但看起来我设置的会话没有在我使用的各种控制器之间共享。所以可以说我有
页面控制器
public $components = array( 'Email', 'Session', 'RequestHandler', 'Cookie');
//this is pages/home
public function home(){
$this->Session->write("bunny", "123456");
debug($this->Session->read("bunny"));
}
人员控制器
public $components = array( 'Email', 'Session', 'RequestHandler', 'Cookie');
//this is person/index
public function index(){
debug($this->Session->read("bunny");
}
当我转到 url http://domian.org/person/index 时,该调试行为空。它不应该打印出“123456”吗?
【问题讨论】:
-
您的意思是在
public index()行中有function吗? -
我已经添加了。谢谢。我仍然有同样的错误。
-
它实际上是在调试“null”,还是没有调试任何东西?
标签: session cakephp cakephp-2.1