我试图为我的模块添加新的错误404页。我有应用程序和我自己的管理模块。对于Application,我使用默认的404.phtml,对于我的新模块,我创建了admin404.phtml,但是我不知道如何运行它。如何改变模块的布局有很多选择,但我无法为我的问题找到答案。有谁可以帮我?
发布于 2014-02-03 03:12:25
当无法找到网页或web应用程序内部发生其他错误时,将显示一个标准错误页。错误页的外观由错误模板控制。有两个错误模板:error/404,用于"404 Page“错误;error/index,用于在应用程序的某个地方抛出未处理的异常时显示。
module.config.php文件包含view_manager键下的几个参数,您可以使用这些参数配置错误模板的外观:
<?php
return array(
//...
'view_manager' => array(
'display_not_found_reason' => true,
'display_exceptions' => true,
//...
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'template_map' => array(
//...
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index'=> __DIR__ . '/../view/error/index.phtml',
),
'template_path_stack' => array(
__DIR__ . '/../view',
),
),
);display_not_found_reason参数控制是否显示有关“未找到的页面”错误的详细信息。display_exceptions参数定义是否显示有关未处理异常及其堆栈跟踪的信息。not_found_template为404错误定义模板名。exception_template为未处理的异常错误指定模板名。您通常在生产系统中将display_not_found_reason和display_exceptions参数设置为false,因为您不希望站点访问者看到有关站点中错误的详细信息。但是,您仍然能够从Apache的error.log文件中检索详细信息。
https://stackoverflow.com/questions/21511052
复制相似问题