Symfony Twig - 如何将参数放入替换 - 错误
Symfony Twig -How put parameter inside replace - error
在 symfony 2.8 中,我在配置中有参数 - twig global - 调用:
haryb_com_text_guides_index: '.....'
我想像这样使用这个变量:
<p class="main">
{{ 'my.description'|trans|nl2br|replace({'%link_start%': "<a href="{{ haryb_com_text_guides_index }}">", '%link_end%': '</a>'})|raw }}
</p>
但我得到了 500 并且:
哈希值后必须跟一个逗号。值为“{”的意外标记 "punctuation"("punctuation" 应为值“,”)。
也许有些转义是错误的?
{{ 'my.description'|trans|nl2br|replace({'%link_start%': '<a href="'~ haryb_com_text_guides_index ~'">', '%link_end%': '</a>'})|raw }}
在 symfony 2.8 中,我在配置中有参数 - twig global - 调用: haryb_com_text_guides_index: '.....'
我想像这样使用这个变量:
<p class="main">
{{ 'my.description'|trans|nl2br|replace({'%link_start%': "<a href="{{ haryb_com_text_guides_index }}">", '%link_end%': '</a>'})|raw }}
</p>
但我得到了 500 并且: 哈希值后必须跟一个逗号。值为“{”的意外标记 "punctuation"("punctuation" 应为值“,”)。
也许有些转义是错误的?
{{ 'my.description'|trans|nl2br|replace({'%link_start%': '<a href="'~ haryb_com_text_guides_index ~'">', '%link_end%': '</a>'})|raw }}