如何隐藏ZendFramework3提供的浏览器错误?

时间:2017-06-03 04:40:15

标签: php exception zend-framework syntax runtime-error

如何隐藏它在浏览器中显示的框架错误? 我在application.config中搜索,Application module.config尝试更改标志和模板但没有效果。

如何在浏览器中隐藏错误但将其保留在控制台中?

作为我正在使用的服务器,现在在php5.6服务器中构建

  'view_manager' => [
    'display_not_found_reason' => true,
    'display_exceptions'       => false,
    'doctype'                  => 'HTML5',
    'not_found_template'       => 'error/404',
    'exception_template'       => 'error/index',
    'template_map' => [
        'layout/layout'           => __DIR__ . '/../view/layout/layout.phtml',
        'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
        'error/404'               => __DIR__ . '/../view/error/custom_404.phtml',
        'error/index'             => __DIR__ . '/../view/error/index.phtml',
    ],
    'template_path_stack' => [
        __DIR__ . '/../view',
    ],
],

1 个答案:

答案 0 :(得分:1)

有两种方法可以做到这一点,因为zend是一个PHP框架,因此您可以使用php代码或zend设置文件隐藏它。

1)核心PHP。

error_reporting(E_ALL);
ini_set('display_errors', true);

PHP error settings

2)Zend根据您的要求更改您的设置false将隐藏您的错误。

/*in your module.config.php */
'view_manager' => array(
    'display_not_found_reason' => true,
    'display_exceptions' => true,
    'doctype' => 'HTML5',
    'not_found_template' => 'error/404',
    'exception_template' => 'error/index',
    'template_map' => array(
        'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
        '/index/index' => __DIR__ . '/../view/user/index/index.phtml',
        'error/404' => __DIR__ . '/../view/error/404.phtml',
        'error/index' => __DIR__ . '/../view/error/index.phtml',
    ),
    'template_path_stack' => array(
        __DIR__ . '/../view',
    ),
),