在Symfony中禁用错误​​页面

nou*_*ine 1 php symfony

我想在Symfony中彻底禁用twig错误页面.我不想像这里描述的那样自定义它们:http://symfony.com/doc/2.0/cookbook/controller/error_pages.html但是只需拔掉twig的异常处理机制,最后得到简单的旧php错误.

有可能吗?

Ziu*_*min 8

要禁用twig错误页面,您只需添加类似的内容即可

services:
   twig.exception_listener:
     class: DateTime #or another dummy class
Run Code Online (Sandbox Code Playgroud)

到你的app/config.yml

在此之后,您将看到Symfony\Component\HttpKernel\Debug\ExceptionHandler生成的简单屏幕.如果要删除此行为 - 替换此类或只是注释set_exception_handler调用.

public static function register($debug = true)
{
    $handler = new static($debug);

    set_exception_handler(array($handler, 'handle'));

    return $handler;
}
Run Code Online (Sandbox Code Playgroud)