zend会话命名空间不起作用

时间:2015-11-21 02:19:46

标签: zend-framework zend-session-namespace

我无法通过布局访问包含文件中的zend会话。

到目前为止我做了什么 -

//bootstrap      
public function _initSession()
    {
      Zend_Session::start();
      $test = new Zend_Session_Namespace('test');

    }

//controller
public function init(){
        $test = new Zend_Session_Namespace('test');
        $test->abc = 'defghi';
}

//layout include file
 <?php include_once(  APPLICATION_PATH . '/data/ga_test.php');?>

//ga_test.php

$test = new Zend_Session_Namespace('test');
echo 'this is ' . $test->abc;

我无法访问ga_test文件中的变量。我得到一个空变量。但是如果我在每个视图文件中包含ga_test结尾那么它就可以了。显然,我不想去每个视图文件并包含ga_test.php。我可以通过布局来做到这一点。

我确信,我在这里做错了。任何帮助将非常感激。

由于

0 个答案:

没有答案