Symfony2 / Twig - getting array from dynamic array key

前端 未结 3 562
醉话见心
醉话见心 2021-02-12 18:32

In PHP I would do this:

foreach( $array as $key => $value ) {

    echo $another_array[$key];

}

I can\'t see how to do that in Twig (in Sym

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-12 18:40

      {% for value in array %} {% set the_index = attribute(another_array, loop.index) %}
    • {{ the_index }}
    • {% endfor %}

提交回复
热议问题