【发布时间】:2023-03-11 18:14:01
【问题描述】:
我在 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'; 中使用此代码进行渲染时,它会显示“测试”文本。怎么办?
【问题讨论】:
-
也许 $form = new Application_Form_User() ? ;)
-
对不起,我的错误 - 没有 Application_...
标签: php zend-framework zend-form