仿站咨询QQ:2587483189

手机微信同号:15850888840

dedecms织梦点击数过千、万、亿的写法

 在 include\extend.func.php 最下面加个dede仿站函数

01
function click_round_number( $number, $min_value = 1000, $decimal = 1 ) {
02
    if( $number < $min_value ) {
03
        return $number;
04
    }
05
    $alphabets = array( 100000000 => '亿', 10000 => '万', 1000 => '千' );
06
    foreach( $alphabets as $key => $value )
07
    if( $number >= $key ) {
08
        return round( $number / $key, $decimal ) . '' . $value;
09
    }
10
}
调用标签如下:
1
{dede:field.click function="click_round_number(@me)"/}
效果:
1000=1千;
15000=1.5万;
210000=21万。

  • 上一篇:dede 列表页 上一页下一页 只要链接
  • 下一篇:阿里云提示织梦DedeCMS uploadsafe.inc.php上传漏洞的解决方法
  • 来源:未知//所属分类: dede仿站 /更新时间:2018-08-23
    相关仿站教程