{% for product in products %} {% set totalPrice = (product.quantity * product.price)|number_format(2, '.', ',') %} {% endfor %} {{ totalPrice }}
我需要totalPrice在循环内将值添加到自身,以得出循环内物品的总价。
totalPrice
这可能吗?
iteration templates for-loop symfony twig
for-loop ×1
iteration ×1
symfony ×1
templates ×1
twig ×1