【发布时间】:2019-10-10 09:37:43
【问题描述】:
我无法在 for 循环中获取键和值 我的要求应该是 标题 - 描述
我无法获取标题和描述中的值
(
[product_benefit] => Array(
[0] => Array
(
[description] => Lorem Ipsum is simply dummy text of the printing and typesetting industry.
[title] => Ipsum Lorem
)
[1] => Array
(
[description] => Lorem Ipsum is simply dummy text of the printing and typesetting industry.
[title] => Ipsum Lorem
)
[2] => Array
(
[description] => Lorem Ipsum is simply dummy text of the printing and typesetting industry.
[title] => Ipsum Lorem
)
[3] => Array
(
[description] => Lorem Ipsum is simply dummy text of the printing and typesetting industry.
[title] => Entertainment
)
)
{% if product.product_benefit is not null %}
<ul class="manual-list">
{% for row in product.product_benefit %}
{% for slug, item in row %}
<li><b>{{ item.title - item.description }}</b></li>
{% endfor %}
{% endfor %}
</ul>
【问题讨论】:
-
不工作的老板
- {{ item }}
启用获取值
标签: symfony twig symfony4 drupal-8 drupal-modules