duanhong4274 2017-01-11 11:44
浏览 63
已采纳

Twig 2.0错误消息“禁止访问Twig_Template属性”

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.

  • 写回答

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/2336

    Solution: 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?