我正在开发一个用 Symfony 4.4 编写的应用程序。 它使用 EWZRecaptchaBundle 来处理验证码。 但是,当同一页面上有两个验证码时,此捆绑包的处理效果不佳。 为了解决这个问题,我不得不通过创建
templates/Bundles/EWZRecaptchaBundle/Form/ewz_recaptcha_widget.html.twig
来覆盖它的模板
在我的本地开发环境 (Symfony Server) 中,这工作正常。
debug:twig
显示 Symfony 检测两个模板位置(原始包和我的覆盖)
symfony console debug:twig
...
@EWZRecaptcha templates/bundles/EWZRecaptchaBundle/
vendor/excelwebzone/recaptcha-bundle/src/Resources/views/
@!EWZRecaptcha vendor/excelwebzone/recaptcha-bundle/src/Resources/views/
...
但是,在生产中我仍然从原始包中获取模板,而不是我的覆盖。
bin/console --env=prod debug:twig
...
@EWZRecaptcha vendor/excelwebzone/recaptcha-bundle/src/Resources/views/
@!EWZRecaptcha vendor/excelwebzone/recaptcha-bundle/src/Resources/views/
...
我希望我的模板覆盖在生产中使用,就像在开发中一样。
我试过清除缓存。