0
我試圖建立一個模塊的第一次,我遇到了此問題:找不到模塊控制器
Exception information:
Message: Invalid controller specified (index)
Stack trace:
#0 C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\Controlle\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#2 C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#3 C:\Program Files (x86)\Zend\Apache2\htdocs\dev.paygiant.com\public\index.php(30): Zend_Application->run()
#4 {main}
Request Parameters:
array (
'module' => 'admin',
'controller' => 'index',
'action' => 'index',
)
我的應用程序目錄:
configs/
controllers/
modules/
Admin/
controllers/
IndexController.php
models/
views/
的管理指標控制器:
<?php
class IndexController extends Zend_Controller_Action {
public function init()
{
//
}
public function indexAction()
{
// action body
}
}
我的application.ini文件包含:
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] =
在我的引導文件:
public function _initModuleLoaders()
{
$this->bootstrap('Frontcontroller');
$fc = $this->getResource('Frontcontroller');
$modules = $fc->getControllerDirectory();
foreach ($modules AS $module => $dir) {
$moduleName = strtolower($module);
$moduleName = str_replace(array('-', '.'), ' ', $moduleName);
$moduleName = ucwords($moduleName);
$moduleName = str_replace(' ', '', $moduleName);
$loader = new Zend_Application_Module_Autoloader(array(
'namespace' => $moduleName,
'basePath' => realpath($dir . "/../"),
));
}
}
我在做什麼錯?
此外,在非默認模塊 - 比如管理員,我想 - 控制器類的名稱應該以模塊名稱作爲前綴:Admin_IndexController而不只是IndexController。 –
啊是的@DavidWeinraub好點。 – Dan
做到了。謝謝! – liz