【发布时间】:2010-12-16 14:59:14
【问题描述】:
我是 Zend 框架的初学者,目前遇到一个小问题:
我正在创建一个基于模块化架构的项目并请求此 URL:
http://localhost/MyApp/public/ --> index.php 所在的位置。我的核心模块在 /application/modules 目录中被称为“核心”,如下所示:
/Applications/modules/
-- Core
---- controllers
------ ErrorController.php
------ IndexController.php
---- views
------ scripts
-------- error/error.phtml
-------- index/index.phtml.
每次我刷新页面时都会显示 error.phtml,这很奇怪。因为我的模块确实定义了它的路由如下:
[routes]
routes.core_index_index.type = "Zend_Controller_Router_Route_Static"
routes.core_index_index.route = "/"
routes.core_index_index.defaults.module = "core"
routes.core_index_index.defaults.controller = "index"
routes.core_index_index.defaults.action = "index"
routes.core_index_index.defaults.frontend = "true"
routes.core_index_index.defaults.langKey = "route_index_page_description"
routes.core_index_index.defaults.localization.enable = "true"
加上我确实将 RewriteBase 设置为 /var/www/html/MyApp/public 的事实。那么为什么显示我的error.phtml 而index.phtml 应该是要渲染的视图脚本呢?
以下是我在 application.ini 中的生产配置设置
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.defaultModule = core
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.frontController.params.prefixDefaultModule = "1"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
正在显示的错误页面内容:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Zend Framework Default Application</title>
</head>
<body>
<h1>An error occurred</h1>
<h2>Page not found</h2>
</body>
</html>
非常感谢任何帮助。
【问题讨论】:
-
是否抛出异常?错误的内容是什么?
-
请在我的帖子中查看修改
标签: php model-view-controller zend-framework