【发布时间】:2012-03-30 00:35:48
【问题描述】:
Twig 中include with only 的真正目的是什么:
{# only the foo variable will be accessible #}
{% include 'child.html.twig' with {'foo': 'bar'} only %}
也许有一些性能好处?或者只是为了避免在包含的模板中覆盖变量?作为documentation:
包含的模板可以访问活动上下文的变量。您可以通过附加唯一关键字来禁用对上下文的访问。
【问题讨论】: