dshgdhdfcas30210 2011-05-23 15:18
浏览 76

Zend Framework模块不起作用

Hi I'm unable to make my Zend Framework application to use modules. Basicly I have two modules named 'default' (yes, it's my default module) and 'panel'. I want to call a Login controller under this request:

mywebsite.host/panel/login/index

thus it should get me LoginController under: /panel/controllers/LoginController.php the class of the LoginController.php is panel_LoginController.

Here is my debug code from the 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);
}

And I'm getting this:

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
)

And:

/application/default/controllers/IndexController.php|IndexController.php

Where it should be: /application/panel/controllers/IndexController.php|IndexController.php

My ini config file is somthing like this:

[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"

Any idea what I'm doing wrong? Of course if I return Standard.php to native Zend library state I've got fatal error that controller can't be found.

  • 写回答

2条回答 默认 最新

  • dongliao3742 2011-05-23 17:11
    关注

    having application directory as module directory isn't a good idea. This will result in registering ALL subfolders as modules.

    classname should be Panel_LoginController

    评论

报告相同问题?

悬赏问题

  • ¥15 请提供一个符合要求的网页链接。
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码