Zend应用程序模块结构中的控制器类错误无效

时间:2011-08-04 13:21:41

标签: php zend-framework

I use Zend framework.I want to do Zend Application Module Structure

When I open "http://localhost/aileTerapisi_z/public" I see Zend framework home page but
When I open "http://localhost/aileTerapisi_z/public/yonetim", it give me thiss eror:

Message: Invalid controller class ("Yonetim_IndexController")

[h=3]Request Parameters:[/h]
array ( 'module' => 'yonetim', 'controller' => 'index', 'action' => 'index', ) 

how do I resolve this error

My structure is this:

application
configs
application.ini
modules
yonetim
controllers
IndexController.php
models
views
helpers
scripts
index
index.phtml

default
controllers
IndexController.php
models
views
helpers
scripts
index
index.phtml

Bootstrap.php

library
public
.htaccess
index.php


My application/configs/application.ini file is like this:

[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"

appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/modules/default/controllers"
resources.frontController.controllerDirectory = APPLICATION_PATH "/modules/yonetim/controllers"
resources.frontController.params.displayExceptions = 1

autoloadernamespaces.0 = "App_"
autoloadernamespaces.1 = "Zend_"
autoloadernamespaces.2 = "ZendX_"

resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.moduleControllerDirector yName = "controllers"

resources.frontController.env = APPLICATION_ENV
resources.frontController.throwerrors = false


resources.db.adapter = PDO_Mysql
resources.db.params.host =
resources.db.params.username =
resources.db.params.password =
resources.db.params.dbname =


;layoutpath
resources.layout.layout = "layout"
resources.layout.layoutPath = APPLICATION_PATH "/modules/default/views/layouts"
resources.layout.layoutPath = APPLICATION_PATH "/modules/yonetim/views/layouts"

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
resources.frontcontroller.throwerrors = true 

2 个答案:

答案 0 :(得分:0)

这是使用模块结构的简单application.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"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0

resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.layout.layout = default

resources.modules[] = ""
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

您可以在以下文件结构中使用此配置。

application
    configs
    controllers
       IndexController.php
    layout
       scripts
           defalut.phtml
           yonetim.phtml
    models
    modules
         yonetim
               controoler
                    IndexController.php
               models
               views
                    helpers
                    scripts
                          index
                               index.phtml       

    views
          helpers
              scripts
                  index
                     index.phtml  

public
library

答案 1 :(得分:0)

Zend有很好的错误控制。从错误的外观来看,您的Controller * Yonetim_IndexController.php *确实存在,但是在php文件中,一个具有类似于的预期名称的类:

class .*YonetimController extends Zend_Controller_Action {
}

似乎缺失 - 哪里。*可能是任何字母。 如果您使用copy-any-paste模板化其他控制器,并且忘记更改类名,则可能会发生这种情况。