简体   繁体   English

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

[英]Invalid controller class error in Zend Application Module Structure

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 

Zend has pretty good Error Control. Zend具有很好的错误控制。 From the look of the error your Controller *Yonetim_IndexController.php* does exist, however inside the php-file a class with the expected name similar to: 从错误的外观来看,您的Controller * Yonetim_IndexController.php *确实存在,但是在php文件中有一个类,其预期名称类似于:

class .*YonetimController extends Zend_Controller_Action {
}

seems to be missing - where .* may be any letters. 似乎丢失了-。*可能是任何字母。 That may happen sometime if you are copy-any-paste templating other Controllers, and forget to change the classname. 如果您正在复制粘贴任何模板的其他Controller,而忘记更改类名,则可能会发生这种情况。

This is simple application.ini for using module structure. 这是使用模块结构的简单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

You can use this configuration in following file structure. 您可以在以下文件结构中使用此配置。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM