我在尝试使用Zend_Form_SubForm和会话时遇到了问题。我的控制器在essance中扮演向导,根据向导的阶段显示不同的子窗体。使用这个示例,我计划将表单存储在会话命名空间中。
我的控制器看起来像这样。
include 'mylib/Form/addTaskWizardForm.php';
class AddtaskController extends Zend_Controller_Action{
private $config = null;
private $log = null;
private $subFormSession = null;
/**
* This function is called and initialises the global variables to this object
* which is the configuration details and the logger to write to the log file.
*/
public function init(){
$this->config = Zend_Registry::getInstance()->get('config');
$this->log = Zend_Registry::getInstance()->get('log');
//set layout
$this->_helper->layout->setLayout('no-sidemenus');
//we need to get the subforms and
$wizardForms = new addTaskWizardForm();
$this->subFormSession = new Zend_Session_Namespace('addTaskWizardForms');
if(!isset($this->subFormSession->subforms)){
$this->subFormSession->subforms = $wizardForms;
}
}
/**
* The Landing page controller for the site.
*/
public function indexAction(){
$form = $this->subFormSession->subforms->getSubForm('start');
$this->view->form = $form;
}但是,这会导致应用程序会话崩溃。
未指明的异常'Zend_Session_Exception‘与消息'Zend_Session::start()
知道为什么这和Zend会议有问题吗?
谢谢。
发布于 2009-09-17 14:50:11
确保会话开始前没有空格、新行或任何其他字符。特别是如果您有包含,并且您的<?php在文件的第2行中加上了空格或开始。
发布于 2009-09-15 16:54:53
非常奇怪,我看到这样的消息是在Zend/Session.php的第435至446行上发送的。
您是否试图通过单元测试运行该代码?在初始化会话之前,请检查没有发送任何标头。
https://stackoverflow.com/questions/1426975
复制相似问题