Cakephp会话值没有进入IE浏览器

时间:2013-10-18 12:34:40

标签: internet-explorer session cakephp

天儿真好

我没有在Cakephp(2.2.0)项目的IE浏览器中获得Session值。请找到以下场景并建议我需要做什么。

情景 - 1

// Here i am storing session value to SessionHold array as follows.

class TestController extends AppController {

public function index(){
         $this->Session->write('SessionHold.unique_id', $uniqe_id);
         $this->Session->write("SessionHold.zipcode", $this->request->data['Test']['zipcode']);
         $this->Session->write("SessionHold.business", $this->request->data['Test']['business']);   
}

    }

情景 - 2

//在这个控制器中我得到会话值

class SecondController extends AppController {

        public function index(){
          pr($this->Session->read()); // i am getting same session  value in this action.
        }

}

情景 - 3

  1. 在此操作中,我有一个表单。在发布表单之前,我在此页面中获得相同的会话值。
  2. 一旦我发布表单并在第一行中打印相同的会话数组,但IE broswer中的结果为空。
  3. 它在其他浏览器中运行良好,如Mozilla,Chrome和Safari

    类FinalController扩展AppController {

    public function index(){
     pr($this->Session->read()); // getting value before posting the form         
    
     **pr($this->Session->read()); exit;** // not getting the session value after posting the form   
    
    }
    

    }

  4. 请帮助我解决上述问题。我非常感谢提前帮助。谢谢。

2 个答案:

答案 0 :(得分:1)

如果cakephp会话不起作用,请尝试PHP会话。您可以在AppController.php中使用@session_start()方法。

有时我也遇到过这个问题,但是如果我们这样做的话,那就是正常工作。

答案 1 :(得分:0)

试试这个。

<?php
// try this one...
class SecondController extends AppController {
    public function index(){
        pr( $this->Session->read('SessionHold') );
    }
}

由于