更改 Zend Framework 默认模块
我正在开发一个项目,并具有以下项目布局:
|Project
|-Application
|-api
|-configs
|-controllers
|-models
|-modules
|-core
|-controllers
|-models
|-views
|-Bootstrap.php
|-site1
|-site2
|-site3
|-views
|-Bootstrap.php
|-Docs
|-Library
|-Public
|-.zfproject.xml
我在 application.ini 中使用了它来尝试将 default
模块设置为 core
模块:
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.defaultModule = "core"
resources.frontController.defaultControllerName = "Index"
resources.frontController.defaultAction = "index"
resources.modules[] = ""
我的问题是,由于某种原因,我无法让引导程序在模块中工作。就好像默认模块没有被更改一样。应用程序的行为就像它一样,直到我尝试加载引导程序 - 我收到此错误:
致命错误:未捕获的异常“Zend_Application_Resource_Exception” 带有消息“找到模块“默认”的引导文件,但引导程序 未找到“Default_Bootstrap”类 M:\Zend_Framework\library\Zend\Application\Resource\Modules.php 上 第85行
以此错误为前缀:
Zend_Application_Resource_Exception:找到模块的引导文件 “default”但未找到引导类“Default_Bootstrap” M:\Zend_Framework\library\Zend\Application\Resource\Modules.php 上 第85行
有人能看出我哪里出错了吗?
我的应用程序/Bootstrap.php 文件:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
}
我的应用程序/Core/Bootstrap.php 文件:
class Core_Bootstrap extends Zend_Application_Module_Bootstrap
{
}
I'm working on a project and have the following project layout:
|Project
|-Application
|-api
|-configs
|-controllers
|-models
|-modules
|-core
|-controllers
|-models
|-views
|-Bootstrap.php
|-site1
|-site2
|-site3
|-views
|-Bootstrap.php
|-Docs
|-Library
|-Public
|-.zfproject.xml
I've used this in my application.ini to try and set the default
module to be the core
module:
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.defaultModule = "core"
resources.frontController.defaultControllerName = "Index"
resources.frontController.defaultAction = "index"
resources.modules[] = ""
My problem is that for some reason, I can't get bootstraps working in the modules. It's alsmost as if the default module isn't being changed. The application behaves like it is, until I try and load the bootstraps - I get this error:
Fatal error: Uncaught exception 'Zend_Application_Resource_Exception'
with message 'Bootstrap file found for module "default" but bootstrap
class "Default_Bootstrap" not found' in
M:\Zend_Framework\library\Zend\Application\Resource\Modules.php on
line 85
Prefixed by this error:
Zend_Application_Resource_Exception: Bootstrap file found for module
"default" but bootstrap class "Default_Bootstrap" not found in
M:\Zend_Framework\library\Zend\Application\Resource\Modules.php on
line 85
Can anyone see where I'm going wrong?
My Application/Bootstrap.php file:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
}
My Application/Core/Bootstrap.php file:
class Core_Bootstrap extends Zend_Application_Module_Bootstrap
{
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不是 100%,但如果删除以下行:
可能会解决问题。如果我没记错的话,当您使用模块时,设置它会导致错误。
Not 100% on this but if you remove the following line:
that may resolve the issue. If i'm not mistaken, as you're using modules, setting this will cause an error.
看起来您的 application.ini 中可能缺少一行:
尝试以这种方式使用它并查看它是否有效,我认为这只是告诉应用程序在使用模块时,名为 'default'< 的模块/em> 没有前缀。
虽然我可能是错的,所以你可能必须尝试一下。
好吧,也许少了两行:)
Looks like you might be missing one line from your application.ini:
Try using it this way and see if it works, I think this just tells the app that when using modules, the module named 'default' has no prefix.
Although I could be wrong so you may have to experiment.
Ok, maybe two lines are missing :)