Since upgrading to Twig 2.0 I get the error message Accessing Twig_Template attributes is forbidden. The referred line contains either an {{ include }} or a macro call.
Twig 2.0错误消息“禁止访问Twig_Template属性”
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
doutuosai3504 2017-01-11 11:44关注In Twig 2.0
{{ import }}'ed macros are not inherited to child templates anymore, see https://github.com/twigphp/Twig/issues/2336Solution: You need to import the required macro(s) in every single .twig file.
If the error is showing up on a line containing
{{ include }}or{{ extends }}, you have to look into the template that's being included/extended, and import the macro there.本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报