Zend framework Zend框架:我的表单不会渲染
所以我在下面用Zend框架创建了一个表单,然后我将对其进行定制。我的第一个问题是,使用csrf哈希安全性,我会得到一个应用程序错误。然而,当我删除这些行时,我得到的只是一个空白屏幕,只有在我删除CPATCHA保护时才能解决。谁能给我解释一下原因吗 我的表格:Zend framework Zend框架:我的表单不会渲染,zend-framework,zend-form,zend-form-element,Zend Framework,Zend Form,Zend Form Element,所以我在下面用Zend框架创建了一个表单,然后我将对其进行定制。我的第一个问题是,使用csrf哈希安全性,我会得到一个应用程序错误。然而,当我删除这些行时,我得到的只是一个空白屏幕,只有在我删除CPATCHA保护时才能解决。谁能给我解释一下原因吗 我的表格: class Application_Form_Clips extends Zend_Form { public function init() { // Set the method for the di
class Application_Form_Clips extends Zend_Form
{
public function init()
{
// Set the method for the display form to POST
$this->setMethod('post');
// Add an email element
$this->addElement('text', 'email', array(
'label' => 'Your email address:',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
'EmailAddress',
)
));
// Add the comment element
$this->addElement('textarea', 'comment', array(
'label' => 'Please Comment:',
'required' => true,
'validators' => array(
array('validator' => 'StringLength', 'options' => array(0, 20))
)
));
// Add a captcha
$this->addElement('captcha', 'captcha', array(
'label' => 'Please enter the 5 letters displayed below:',
'required' => true,
'captcha' => array(
'captcha' => 'Figlet',
'wordLen' => 5,
'timeout' => 300
)
));
// Add the submit button
$this->addElement('submit', 'submit', array(
'ignore' => true,
'label' => 'Sign Guestbook',
));
// And finally add some CSRF protection
$this->addElement('hash', 'csrf', array(
'ignore' => true,
));
}
}
我的控制器:
class AdminController extends Zend_Controller_Action
{
public function init()
{
// get doctrine and the entity manager
$this->doctrine = Zend_Registry::get('doctrine');
$this->entityManager = $this->doctrine->getEntityManager();
// get the users repository
$this->indexVideos = $this->entityManager->getRepository('\ZC\Entity\Videos');
$this->indexClips = $this->entityManager->getRepository('\ZC\Entity\Clips');
}
public function indexAction()
{
// action body
}
public function clipsAction()
{
// get a form
$form = new Application_Form_Clips();
$this->view->form = $form;
}
public function videosAction()
{
// action body
}
}
我的看法是:
<?php echo $this->form; ?>
基本错误,我没有在php.ini中取消session.pat的注释在php.ini中
启用display\u errors
并将error\u reporting
设置为E\u ALL
。您的空白屏幕将被一条错误消息取代,该消息告诉您PHP终止的原因。