使用round(),sprintf()或number_format().
例子:
<?php
$res = 123/1000;
printf('%.2f', $res);
echo round($res, 2);
echo number_format($res, 2);
?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
87 次 |
| 最近记录: |