“Значение ключа FOREACH TWIG” Ответ

Значение ключа FOREACH TWIG

{% for key, user in users %}
    <li>{{ key }}: {{ user.username }}</li>
{% endfor %}
Easy Elk

веточка петли

loop.index	    The current iteration of the loop. (1 indexed)
loop.index0	    The current iteration of the loop. (0 indexed)
loop.revindex	The number of iterations from the end of the loop (1 indexed)
loop.revindex0	The number of iterations from the end of the loop (0 indexed)
loop.first	    True if first iteration
loop.last	    True if last iteration
loop.length	    The number of items in the sequence
loop.parent	    The parent context

{% for user in users %}
    {{ loop.index }} - {{ user.username }}
{% endfor %}
Annoying Ant

веток для ключа петли

{% for key, user in users %}
	<li>{{ key }}: {{ user.username|e }}</li>
{% endfor %}
Frail Finch

Ответы похожие на “Значение ключа FOREACH TWIG”

Вопросы похожие на “Значение ключа FOREACH TWIG”

Больше похожих ответов на “Значение ключа FOREACH TWIG” по HTML

Смотреть популярные ответы по языку

Смотреть другие языки программирования