0

谁能告诉我为什么会这样:

{% for key, logo in it %}
{% set imageUrl = "bundles/acme/img/it/"~logo %}
<li><img src="{{ get_image(imageUrl) }}" alt="{{ key }}"0/></li>
{% endfor %}

导致这个:

An exception has been thrown during the compilation of a template ("Attribute "value" does not exist for Node "Twig_Node_Expression_Name".")

谢谢任何建议

4

1 回答 1

1

改用该asset()方法...

{% for key, logo in it %}
   {% set imageUrl = "bundles/acme/img/it/"~logo %}
   <li><img src="{{ asset(imageUrl) }}" alt="{{ key }}"/></li>
{% endfor %}
于 2013-07-04T13:25:38.610 回答