[英]Zend Framework modules not working
嗨,我無法使我的Zend Framework應用程序使用模塊。 基本上,我有兩個名為“默認”的模塊(是的,這是我的默認模塊)和“面板”。 我想在此請求下調用登錄控制器:
mywebsite.host/panel/login/index
因此,它應該讓我在以下位置的LoginController:/panel/controllers/LoginController.php LoginController.php的類是panel_LoginController。
這是來自Standard.php的調試代碼->
public function isDispatchable(Zend_Controller_Request_Abstract $request)
{
$className = $this->getControllerClass($request);
echo '<pre>'; print_r($request); echo '</pre>';
if (!$className) {
return false;
}
if (class_exists($className, false)) {
return true;
}
$fileSpec = $this->classToFilename($className);
$dispatchDir = $this->getDispatchDirectory();
$test = $dispatchDir . DIRECTORY_SEPARATOR . $fileSpec;
echo '<pre>'; print_r($test .'|'.$fileSpec); echo '</pre>';
return Zend_Loader::isReadable($test);
}
我得到這個:
Zend_Controller_Request_Http Object
(
[_paramSources:protected] => Array
(
[0] => _GET
[1] => _POST
)
[_requestUri:protected] => /
[_baseUrl:protected] =>
[_basePath:protected] =>
[_pathInfo:protected] => /
[_params:protected] => Array
(
[controller] => index
[action] => index
[module] => default
)
[_rawBody:protected] =>
[_aliases:protected] => Array
(
)
[_dispatched:protected] => 1
[_module:protected] => default
[_moduleKey:protected] => module
[_controller:protected] => index
[_controllerKey:protected] => controller
[_action:protected] => index
[_actionKey:protected] => action
)
和:
/application/default/controllers/IndexController.php|IndexController.php
應該在哪里:/application/panel/controllers/IndexController.php|IndexController.php
我的ini配置文件是這樣的:
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
;resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
;resources.frontController.moduleDirectory = APPLICATION_PATH
resources.layout.layoutpath = APPLICATION_PATH "/layouts"
resources.layout.layout = default
resources.frontController.modules = true
;resources.frontController.controllerDirectory = APPLICATION_PATH "/default/controllers"
resources.frontController.moduleControllerDirectoryName = "controllers"
resources.frontController.moduleDirectory = APPLICATION_PATH ""
resources.frontController.defaultControllerName = "index"
resources.frontController.defaultAction = "index"
resources.frontController.defaultModule = "default"
resources.frontController.params.prefixDefaultModule = "1"
cache.frontend = Core
cache.backend = File
cache.frontendOptions.automatic_serialization = true
cache.backendOptions.cache_dir = APPLICATION_PATH "/../temp"
知道我在做什么錯嗎? 當然,如果我將Standard.php返回到本機Zend庫狀態,則會出現致命錯誤,即找不到控制器。
將應用程序目錄作為模塊目錄不是一個好主意。 這將導致將所有子文件夾注冊為模塊。
類名應該是Panel_LoginController
試試看-放入您的application.ini:
resources.modules[] = ""
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
然后在“應用程序”中創建“模塊”文件夾。 每個模塊都應具有Bootstrap.php文件,其中包含:
class Somemodule_Bootstrap extends Zend_Application_Module_Bootstrap {}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.