首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ZendFramework模块

ZendFramework模块
EN

Stack Overflow用户
提问于 2012-01-08 02:09:39
回答 2查看 477关注 0票数 0

我有关于模块的问题,我在网上搜索,但我不能让它工作。

这是我的目录结构

代码语言:javascript
复制
Layout
application
  configs
  Modules
    default
        controllers
        models
        views
          helper
          scripts
             index
             error
        Bootstrap.php
    Bootstrap.php
docs
library
  DoctrineORM 2.1.5
test

我的application.ini

代码语言:javascript
复制
[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.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] =

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0

resources.router.routes.home.route = /home
resources.router.routes.home.default.module = default
resources.router.routes.home.default.controller = index
resources.router.routes.home.default.action = index

[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

我的Bootstap.php (所有Bootstrap.php文件都是相同的)

代码语言:javascript
复制
class Bootstrap extends Zend_Application_Module_Bootstrap

}

我得到的只是一张白纸。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-01-10 03:46:11

在基于模块的ZF应用程序中,有两种不同类型的引导程序文件:应用程序引导程序和模块引导程序。应用程序目录中的此Bootstrap.php应如下所示:

代码语言:javascript
复制
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {}

每个模块目录中的Bootrap.php应如下所示:

代码语言:javascript
复制
class ModuleName_Bootstrap extends Zend_Application_Module_Bootstrap {}

(ModuleName应替换为模块的名称)。

还可以定义默认模块名称以及默认模块是否具有名称空间前缀:

代码语言:javascript
复制
resources.frontController.defaultmodule = "example"
resources.frontController.params.prefixDefaultModule = 1

这将告诉frontController默认模块是example,并且该模块中的所有类都以Example_为前缀。

票数 0
EN

Stack Overflow用户

发布于 2012-01-08 02:14:34

如果您的配置正在查看生产设置,请确保更改

代码语言:javascript
复制
phpSettings.display_errors = 1

在您的生产标签下

如果您的代码看起来与您发布的代码完全相同,则缺少一个大括号

代码语言:javascript
复制
class Bootstrap extends Zend_Application_Module_Bootstrap
{
}

如果你得到一个空白页面,10次中有9次是因为display_errors没有打开。所以你看不到上面的错误。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8771865

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档