smarty下如何将一个数保存为两位小数
smarty模板是一种缓存技术,下面介绍一下smarty string_format用法 取小数点后2位:
用法如下:
//index.php
$smarty = new Smarty; $smarty->assign('number', 23.5787446); $smarty->display('index.tpl'); //index.tpl: {$number} {$number|string_format:"%.2f"} {$number|string_format:"%d"} //OUTPUT: //23.5787446 //23.58 //24
你要保守你心,胜过保守一切。
本文来自博客园,作者:刘俊涛的博客,转载请注明原文链接:https://www.cnblogs.com/lovebing/p/6171721.html