我正在使用 Zend Framework 中的多模块 CMS。我想创建一个这样的结构:
testsite/
index.php
library/
zend/
test/
application/
configs/
application.ini
modules/
users/
controllers/
models/
....
frontend/
controllers/
models/
....
backend/
controllers/
models/
...
bootstrap.php
我创建了以下代码:
//in application.ini
resources.frontController.defaultModule = "frontend"
resources.frontController.defaultControllerName = "index"
resources.frontController.defaultAction = "index"
resources.frontController.plugins.init = "Test_Controller_Plugin_Initializer"
//in bootstrap.php
protected function _initControllers()
{
$this->bootstrap('frontController');
$this->_front = $this->getResource('frontController');
$this->_front->addControllerDirectory(APPLICATION_PATH . '/backend/controllers', 'backend');
$this->_front->addControllerDirectory(APPLICATION_PATH . '/frontend/controllers', 'frontend');
}
//in Test/controllers/plugin/initializer.php
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$front = Zend_Controller_Front::getInstance();
$request = $front->getRequest();
$request->setModuleName('frontend');
$request->setControllerName('index');
$request->setActionName('index');
}
当我转到我的基本 URL 时它不起作用.../testsite
。你能告诉我我哪里出错了吗?