Zend framework zend表单元素显示问题
请检查下面的代码, 问题是在测试操作中没有显示表单元素 找不到 Test.php-->表单类Zend framework zend表单元素显示问题,zend-framework,Zend Framework,请检查下面的代码, 问题是在测试操作中没有显示表单元素 找不到 Test.php-->表单类 class Application_Form_Test extends Zend_Form { public $T_FILEUP; public $T_SUBMIT; /*function init * initialise all the elements * */ public functi
class Application_Form_Test extends Zend_Form
{
public $T_FILEUP;
public $T_SUBMIT;
/*function init
* initialise all the elements
* */
public function _init()
{
$this->T_FILEUP=new Zend_Form_Element_Text('image');
//$this->T_FILEUP->setDestination(UPLOADS);
$this->T_SUBMIT=new Zend_Form_Element_Submit('add');
}
/*function to generate a form for specific function
* */
public function generateForm()
{
return $this->addElements(array($this->T_FILEUP,$this->T_SUBMIT));
}
}
遗嘱
test.phtml
<?php
//echo $this->nm;
echo $this->form->image;
?>
由于未执行\u init()
方法,因此未生成该方法。我相信您希望使用init()
,而不是\u init()
它没有生成,因为没有执行\u init()
方法。我相信您想使用init()
而不是\u init()
钩子的函数名是错误的(否“):
使用:
钩子的函数名错误(否“”): 使用:
我只是想澄清一下,因为我也有同样的问题 Bootstrap.php
\u initXXXXX()
控制器和表单init()
细微的区别,但如果你没抓住它,它会让你的头撞到墙上。我只是想澄清一下,因为我也有同样的问题 Bootstrap.php
\u initXXXXX()
控制器和表单init()
细微的差别,但如果你不抓住它,它会让你的头撞到墙上
<?php
//echo $this->nm;
echo $this->form->image;
?>
public function init()
{
$this->T_FILEUP=new Zend_Form_Element_Text('image');
//$this->T_FILEUP->setDestination(UPLOADS);
$this->T_SUBMIT=new Zend_Form_Element_Submit('add');
}