Joh*_*lla 23
在PHP中,尝试number_format
:
$n = 1234.5678;
// Two decimal places, using '.' for the decimal separator
// and ',' for the thousands separator.
$formatted = number_format($n, 2, '.', ',');
// 1,234.57
Run Code Online (Sandbox Code Playgroud)