gpt4 book ai didi

math - 带变量的 Twig 数学

转载 作者:行者123 更新时间:2023-12-05 03:06:06 25 4
gpt4 key购买 nike

我想在 Twig 上做一些数学运算。我有 2 个变量,价格和数量,我想将它们相乘。但是当我这样做时:

{{ {{ carts.price }} * {{ carts.quantity }} }}

返回错误

A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "punctuation" of value "{".

我该怎么做

最佳答案

这是因为您复制了 {},请尝试这样的操作:{{ car​​ts.price * carts.quantity }}

一些文档 https://twig.symfony.com/doc/2.x/templates.html#math

关于math - 带变量的 Twig 数学,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49896088/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com