在 include/extend.func.php ***下面加个函数 function click_round_number( $number, $min_value = 1000, $decimal = 1 ) { if( $number $min_value ) { return $number; } $alphabets = array( 100000000 = 亿, 10000 = 万, 1000 = 千 ); foreach
function click_round_number( $number, $min_value = 1000, $decimal = 1 ) { if( $number < $min_value ) { return $number; } $alphabets = array( 100000000 => '亿', 10000 => '万', 1000 => '千' ); foreach( $alphabets as $key => $value ) if( $number >= $key ) { return round( $number / $key, $decimal ) . '' . $value; } }
调用标签如下:
{dede:field.click function="click_round_number(@me)"/}
效果:
1000=1千;
15000=1.5万;
210000=21万。