在TWIG中回合的方法是什么


What is the way to round of in TWIG?

在我看来,我需要对数字进行四舍五入。但是使用了树枝。在TWIG中回合的方法是什么?

您可以使用格式过滤器:

{

{ '%.2f' | format(10.5555) }}

但请注意,它会将其四舍五入为 10.56。

也可以使用number_filter