php - Smarty 上的价格数字格式

标签 php codeigniter css smarty number-formatting

我认为这是一个相当愚蠢的问题,我研究了格式化数字以转换为价格格式的方法。我正在使用 smarty 作为模板系统。是否可以通过 smarty 或某种可用于此目的的方法来格式化价格?

我需要将类型数字 1000000 转换为 $1.000.000

smarty没有输出格式,还有什么办法?

谢谢

最佳答案

使用 PHP 的 money format function

在 smarty 中会是 {$myNumber|money_format:'%i'}

关于php - Smarty 上的价格数字格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17710707/

相关文章:

html - 伪元素的边距错误和垂直对齐

html - CSS - 调整窗口大小时如何编码左列变窄?

PHP 错误 :Unknown SSL protocol error in connection to api. smartsheet.com:443

php - session_start() 不起作用并发出警告,尽管它位于页面顶部

CodeIgniter:是否可以在不使用 .htaccess 的情况下删除 index.php?

codeigniter - 使用 CodeIgniter 对多个模型函数进行单次交易

css - gulp任务浏览器找不到字体后

php - 在 wordpress 中,如何在评论后重定向回引用页面?

javascript - WordPress - 循环内的脚本只能运行一次

php - 如何在php codeIgniter中更新相同的字段但不同的表