每日wordpress计数 - 与thousends分隔符显示数字

时间:2015-11-18 11:47:35

标签: wordpress separator

我想使用此代码显示访问者数量:

                <p> All visitors: 
                 <?php global $count_per_day;
                 if(method_exists($count_per_day,"show"))
                 echo $count_per_day->getUserAll( $return );?><br />
                </p>

目前它显示没有thousend分隔符的数字。 我试过“number_format($ number)”,但它不起作用。

1 个答案:

答案 0 :(得分:0)

替换此行:

echo $count_per_day->getUserAll( $return );?><br />

这三个:

$count_before = $count_per_day->getUserAll( $return );
$count_after = number_format(intval($count_before), 0, null, ' ');
echo $count_after;?><br />

这将输出7000作为7 000.如果您想要另一个分隔符,请替换number_format() - 函数中的第三个变量。例如'.'将输出7.000。