小编Zac*_*101的帖子

Twig 模板 - 循环中的循环迭代和项目

{% for product in products %}
     {% set totalPrice = (product.quantity * product.price)|number_format(2, '.', ',') %}
{% endfor %}

{{ totalPrice }}
Run Code Online (Sandbox Code Playgroud)

我需要totalPrice在循环内将值添加到自身,以得出循环内物品的总价。

这可能吗?

iteration templates for-loop symfony twig

4
推荐指数
1
解决办法
3271
查看次数

标签 统计

for-loop ×1

iteration ×1

symfony ×1

templates ×1

twig ×1