在 includeextend.func.php 最下面加个函数 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 $ […]
在 includeextend.func.php 最下面加个函数
01 |
function click_round_number( $number, $min_value = 1000, $decimal = 1 ) { |
02 |
if ( $number < $min_value ) { |
05 |
$alphabets = array( 100000000 => '亿' , 10000 => '万' , 1000 => '千' ); |
06 |
foreach( $alphabets as $key => $value ) |
07 |
if ( $number >= $key ) { |
08 |
return round( $number / $key, $decimal ) . '' . $value; |
|
调用标签如下:
查看源码打印代码帮助
{dede:field.click function="click_round_number(@me)"/}
效果:
1000=1千;
15000=1.5万;
210000=21万。