March 6, 2010 by SLJ | Category:PHP | No Comment Font size: AA AA
比如我要显示一个三位的数字,当位数不足时在前面加0占位:
<?php $var = sprintf(“%03d”, 12); echo $var; ?>