我在forms / user.php中创建了简单的表单:
class Form_User extends Zend_Form
{
public function __construct() {
parent::__construct();
$this->setName('form_user');
$username = new Zend_Form_Element_Text('username');
$password = new Zend_Form_Element_Password('password');
$email = new Zend_Form_Element_Text('email');
$submit = new Zend_Form_Element_Submit('submit');
$this->addElements(array($username, $password, $email, $submit));
}
}
我的控制器代码是:
public function registrationAction()
{
$this->view->title = 'Reg new acc!';
$this->view->headTitle($this->view->title, 'PREPEND');
$form = new Form_User();
$this->view->form = $form;
// $this->view->form = 'test';
}
和<?php echo $this->form; ?>
当我渲染我的表格时没有任何事情发生,只有白屏。
当我在控制器$this->view->form = 'test';
中使用此代码进行渲染时,它会向我显示“测试”文本。怎么办?
答案 0 :(得分:2)
您可能已关闭error_reporting
或display_errors
,因此当您尝试实例化Form_User
时,您不会看到致命错误,Application_Form_User
应为{{1}} }。