大家好,小弟初识zf有些地方还不太明白:比如我写一个form的时候(用的工具是ZDE),$form=new Zend_form(); 写上这句话以后为什么还要 在前面加上require_once 'Zend/form.php';才行呢?我在网上看别人写的东西都不用require,这是怎么回事呢?是不是我哪的配置不正确?
还有一段代码
class IndexController extends Zend_Controller_Action
{
function indexAction()
{
$this->view->pageTitle = "Zend_Form Example";
$this->view->bodyCopy = "<p >Please fill out this form.</p>"; }
}
里面的$this->view 是从哪来的呢?我自己试着写了一下,this完之后没有view这个东西啊,不太明白,还请高人指点一二,谢谢
还有一段代码
class IndexController extends Zend_Controller_Action
{
function indexAction()
{
$this->view->pageTitle = "Zend_Form Example";
$this->view->bodyCopy = "<p >Please fill out this form.</p>"; }
}
里面的$this->view 是从哪来的呢?我自己试着写了一下,this完之后没有view这个东西啊,不太明白,还请高人指点一二,谢谢
Zend_form类定义在Zend/form.php之中,
所以必须以某种方法require。$this->view是Zend_Controller_Action中的属性,
是一个Zend_View_Interface接口的实例。
如果你什么都不做的话,应该有一个默认Zend_View_Interface,
$this->view可以直接调用。
建议lz看看官方的手册:http://framework.zend.com/manual/zh/index.html
你的$this->view是在Zend_Controller_Action定义的,具体你可以看一下定义的那个类最重要的是好好查看手册
http://ca.php.net/manual/en/language.oop5.autoload.php
http://framework.zend.com/docs/quickstart