我在尝试使用 Zend_Form_SubForm 和会话时遇到问题。我的控制器本质上是一个向导,根据向导的阶段显示不同的子表单。使用我计划将表单存储在会话命名空间中的示例。
我的控制器看起来像这样。
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 Session 有问题吗?
谢谢。