【发布时间】:2016-03-30 06:19:57
【问题描述】:
我正在尝试将关联数组发送到我包含的 Twig 模板中:
{% include 'my-template.twig' with {
items: [
[
'property' => 'value',
'other' => 'value'
],
[
'property' => 'value',
'other' => 'value'
]
]
} %}
我收到此错误:
PHP Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'An array element must be followed by a comma. Unexpected token "operator" of value "=" ("punctuation" expected with value ",")
它似乎不喜欢=>。是我的语法吗?有没有办法做到这一点?
【问题讨论】:
标签: php include twig associative-array