我已经制作了模块Admin。在这个模块中,在控制器中我调用了表单
class Admin_AdminController extends Zend_Controller_Action
{
public function indexAction()
{
//$form = new Application_Form_Login();
$form = new Admin_Form_Admin();
$this->view->form = $form;
}
}
但在控制器中给出错误 - >在application \ modules \ Admin \ controllers \ AdminController.php中找不到“Admin_Form_Admin”类
我的表单位于application \ modules \ Admin \ forms \ Admin.php.Below是我的表单代码
class Admin_Form_Admin extends Zend_Form
{
public function init()
{
this->setMethod('post');
/* Form Elements & Other Definitions Here ... */
$user = $this ->CreateElement('text','username');
$password = $this->createElement('text','password');
$login = $this->createElement('submit','button');
$this->addElements(array($user,
$password,
$login
));
}
}
答案 0 :(得分:0)
这里需要三件事......
您需要引导modules resource
; application.ini
resources.modules[] =
您需要在前端控制器中设置模块目录
; application.ini
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
您需要管理模块中的引导类
<?php
// application/modules/Admin/Bootstrap.php
class Admin_Bootstrap extends Zend_Application_Module_Bootstrap {}
有了这三件事,你的代码应该按原样运行。