Php 在zend框架中创建表单
我想在Zend Framework中创建这样的表单:Php 在zend框架中创建表单,php,zend-framework,Php,Zend Framework,我想在Zend Framework中创建这样的表单: <form action="some action" method="post"> <div class="login_form"> <h3>Admin Login</h3> <ul> <li class="login_user"> <input type="text"
<form action="some action" method="post">
<div class="login_form">
<h3>Admin Login</h3>
<ul>
<li class="login_user">
<input type="text" name="username" value="" />
</li>
<li class="login_pass">
<input type="password" name="password" value="" />
</li>
</ul>
</div>
<input type="submit" class="login_btn blue_lgel" name="submit" value="Login" />
</form>
管理员登录
-
-
如何使用zend_form类使其成为可能??
我刚刚接触zend框架。请查看文档: 这就是它的用途:它是用来回答像你这样的问题的 您的代码将类似于:
class MyForm extends Zend_Form
{
public function init()
{
$this->setAction('/myUrl')
->setMethod('post');
$this->addElement('text', 'username', array('required' => true));
$this->addElement('password', 'passw', array('required' => true));
}
}
然后在控制器的操作中:
public function myAction()
{
$this->view->myForm = new MyForm();
}
在你看来:
<?php echo $this->myForm; ?>
感谢兄弟的回复。它只是创建了表单并正常工作,但是表单是在源代码中的DtDd包装器中生成的,但是我希望表单与我的html代码完全一样。我怎样才能使它尽可能快???@KeyurPanchal使用viewScript装饰器。手册上有。