在fatfree框架中,我可以在不创建字典文件的情况下格式化模板变量吗?


In fatfree framework, can I format template variables without creating dictionary files?

我想在显示在模板上之前将变量格式化为货币。现在我知道我可以创建一个特定于语言的字典文件,并使用它将其格式化为货币,但是有直接的方法吗?

可以,您可以使用format()方法:

echo $f3->format('Price: {0,number,currency}',29.90);//Price: $29.90

更多示例见这里。

在模板中,语法是:

{{'Price: {0,number,currency}',@price|format}}