在另一个包中覆盖 TwigBundle 错误页面

问题描述 投票:0回答:0

我正在开发一个集成自定义模板的 Symfony Bundle。 我想覆盖 TwigBundle

error404.html.twig
error403.html.twig
文件。

按照herehere的文档,我已经在这个目录中创建了我的文件:

  • my-bundle/src/Resources/views/bundles/TwigBundle/Exception/error404.html.twig
  • my-bundle/src/Resources/views/bundles/TwigBundle/Exception/error403.html.twig

但它没有被覆盖。我正在使用 Symfony 5.4.

我用 url 测试:https://parent-project/_error/404

文件需要放在父项目的

templates/
文件夹中,但我想在我的自定义包中覆盖它,这可能吗?

php html symfony twig bundle
© www.soinside.com 2019 - 2024. All rights reserved.