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
