0
我有一个这样的数组,并希望获得内容。Twig For loop array
Array
(
[0] => Array
(
[0] => 1
[id] => 1
[1] => Testnews
[title] => Testnews
[2] => Dies ist eine kleine <strong>Testnews!</strong>
[text] => Dies ist eine kleine <strong>Testnews!</strong>
[3] => 1
[type] => 1
[4] => 1
[timestamp] => 1
[5] => 0
[status] => 0
)
)
我试过如下:
{% for latest_news in news %}
{% for id, title in latest_news %}
id : {{ id }}
title : {{ title }}
{% endfor %}
{% endfor %}
这样的作品,但我不认为这是做的正确方法。
它应该是什么样子?
这是正确的答案 – Touki
误读您的阵列(忽略我的答案)。是的,这是前进的方向。 –
我忘了你可以直接访问数组,如果你添加点。不过谢谢你。也许这会帮助任何人^^ – Michael