Symfony 2.7中的全局细枝参数变换
我在config.yml中添加了一些配置参数,如:Symfony 2.7中的全局细枝参数变换,symfony,twig,Symfony,Twig,我在config.yml中添加了一些配置参数,如: twig: globals: brands: 'land-rover': 'Land Rover' 我的问题是,一旦我使用了这根内部树枝,路虎就变成了路虎 {% for slugKey, name in brands %} <li><a href="{{ path('getSearchResultsByBrand', {'slug': slugKey, 'edition': edition.e
twig:
globals:
brands:
'land-rover': 'Land Rover'
我的问题是,一旦我使用了这根内部树枝,路虎就变成了路虎
{% for slugKey, name in brands %}
<li><a href="{{ path('getSearchResultsByBrand', {'slug': slugKey, 'edition': edition.edition}) }}">{{ name }}</a></li>
{% endfor %}
{%用于slugKey,品牌名称%}
{%endfor%}
为什么这种转换会自动发生?我如何防止它?检查此问题:此修复:谢谢duncan。因为我只需要对一个变量数组使用它,所以我在twig中做了一个| replace。@duncan你应该把它作为aswerCheck发布这个问题:这个修复:谢谢duncan。因为我只需要一个变量数组,所以我在twig中做了一个| replace。@duncan你应该把它作为一个aswer发布