更新时间:2023-01-11 15:24:36
将以下函数添加到现有模型中
add the following function to your existing model
型号
public function numberStyle($n)
{
if ($n < 1000) {
return $n;
}
else
{
$val = ['','k','M','G','T','P','E','Z','Y'];
$run = floor(log($n, 1000));
}
return round($n/(1000**$run),1,PHP_ROUND_HALF_EVEN).$val[$run];
}
然后在您的刀片文件中同步
Then sync in your blade file
{{$user->numberStyle(facebook_follower)}}