gpt4 book ai didi

exception - 如何自定义Symfony异常页面?

转载 作者:行者123 更新时间:2023-12-03 07:44:58 26 4
gpt4 key购买 nike

当symfony 2中出现异常时,它将输出以下页面:

Oops! An Error Occurred

The server returned a "404 Not Found".

Something is broken. Please e-mail us at [email] and let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.
  • 该页面的模板在哪里?
  • 在哪里可以配置要在此处显示的电子邮件?

  • 编辑:
    我不是问如何覆盖模板,如下所示:
    http://symfony.com/doc/current/cookbook/controller/error_pages.html

    我问如何告诉symfony我希望它使用的邮件地址(假设可能),我问模板在哪里,这样我就可以知道如何做到这一点,以及是否可能。

    请回答问题正文而不是标题!

    最佳答案

    the official manual中所述,您可以overwrite templates from other bundles

    All of the error templates live inside TwigBundle. To override the templates, we simply rely on the standard method for overriding templates that live inside a bundle. For more information, see Overriding Bundle Templates. For example, to override the default error template that's shown to the end-user, create a new template located at app/Resources/TwigBundle/views/Exception/error.html.twig:



    您可以在TwigBundle的源代码中找到内置模板,也可以直接 at github。在那里,您可以看到 [email]是硬编码的。

    关于exception - 如何自定义Symfony异常页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10297565/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com