ZF 1.12:Zend_Session :: start()异常

时间:2015-03-10 22:03:17

标签: php ajax session zend-framework zend-session

我的网站上有10个标签的复杂html表单。当用户使用表单方法进入页面时,调用getFormAction()

 public function getFormAction()
{
    $productId = $this->_getParam('productId');

    if (!empty($productId)) {

        //Get model and populate form 
        //... 
       $form = new Form_OnixProduct2();
       $form->populate($model);

    } else {
        $form = new Form_OnixProduct2();
    }

    $currentFeedFormSession = new Zend_Session_Namespace('currentFeedSession');

    $currentFeedFormSession->form = $form;

    $this->view->form = $form;

}


}

在这个动作中我初始化了Zend_Form,将它保存到会话变量中,在视图中我只输出一个第一个标签。使用ajax请求显示所有其他选项卡 - 调用操作 outputOnixTabAction

  public function outputOnixTabAction()
{
    $this->_helper->layout->disableLayout();

    $tabName = $this->_getParam('tabName');

    $currentFeedFormSession = new Zend_Session_Namespace('currentFeedSession');

    $this->view->form = $currentFeedFormSession->form;
    $this->view->tabName = $tabName;

}

我的问题是只显示第一个标签。当我发出显示其他标签的ajax请求时,我收到以下错误:

Message: Zend_Session::start() - /otms/vendor/zendframework/zendframework1/library/Zend/Loader.php(Line:134): Error #2 include_once(): Failed opening 'Zend/View/Helper/OutputComplexForm.php' for inclusion 

虽然在第一个标签视图中成功加载了此帮助程序。在我的自定义控制器插件中调用Zend_Session :: start()start - 对于每个请求,我使用以下代码检查用户角色:

    $auth = Zend_Auth::getInstance();

    if($auth->hasIdentity()) {
        $userRole = $auth->getIdentity()->user_type;
    } else {
        $userRole = 'guest';
    }

和hasIdentity()函数导致Zend / Session / Namespace.php文件行143中的Zend_Session :: start(true)命令。

如果您有任何想法,请与我分享。

UPD

这是我的bootstrap中的自动加载器部件:

    protected function _initAutoload()
{

    $loader = new Zend_Application_Module_Autoloader(
        array(
            'namespace' => '',
            'basePath'  => APPLICATION_PATH
        )
    );

    return $loader;
}

UPD 2

我还发现如果我从

重命名帮助类
Zend_View_Helper_OutputComplexForm

My_View_Helper_OutputComplexForm

并添加行

resources.view.helperPath.My_View_Helper = APPLICATION_PATH "/views/helpers"

到application.ini文件一切正常。但是我没有得到它在Zend_前缀中如此特别的东西?

0 个答案:

没有答案
相关问题