1

我在 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");
 }

当我转到网址http://domian.org/person/index时,该调试行为空。它不应该打印出“123456”吗?

4

1 回答 1

0

我不能说它是错误,但就我在蛋糕 php 上的工作而言。我发现大多数人都面临同样的问题,在这里使用 php 默认函数。

在过滤功能之前使用session_start();ob_clean();在过滤功能之前使用我认为这可以解决您的问题

于 2013-03-18T19:42:21.913 回答