1

我在控制器中设置了一个简单的表单:

$form = new Zend_Form;
$form->addElement(new Zend_Form_Element_Text('name'));
$this->view->form = $form;

但是,当我在我看来回应它时:

echo $this->form;

我明白了Catchable fatal error: Method Zend_Form::__toString() must return a string value in myView.phtml

谁能告诉我为什么会这样?

4

1 回答 1

0

你忘了装饰器

$form->setDecorators( array( array('ViewScript', array('viewScript' => '_forms/simple.phtml'))));
于 2013-05-22T11:13:41.617 回答