问题
Im trying to format numbers with thousands separator Smarty.
So for example 1000 becomes 1,000.
Thanks.
回答1:
or you can use php function inside smarty, this is for number_format, you can use other php function too :)
PHP : number_format($number, 2, '.', ',');
SMARTY :
{$number|number_format:2:".":","}
回答2:
or just in smarty use {$var|number_format:0}
回答3:
Try to use string_format, it uses sprintf to format your string.
来源:https://stackoverflow.com/questions/3193710/formatting-numbers-with-thousands-separator-smarty-php