如何在 Twig 中使用 sprintf 格式化数字?数字、如何在、Twig、sprintf

由网友(在思念里沉沦)分享简介:我需要这样格式化一个数字:I need to format a number like this:sprintf("%05d",$lineNumber)但我在 Symfony2 Twig 模板中.那我该怎么办?But I'm inside a Symfony2 Twig template. So what can...

我需要这样格式化一个数字:

I need to format a number like this:

sprintf("%05d",$lineNumber)

但我在 Symfony2 Twig 模板中.那我该怎么办?

But I'm inside a Symfony2 Twig template. So what can I do?

推荐答案

Twig 提供了很多 过滤器,看看 formatnumber_format.

Twig provides lots of filters, take a look at format and number_format.

阅读全文

相关推荐

最新文章