织梦DedeCMS自动转换数字的函数代码
这个想法很独特,不过也很实用,特别对于那些频繁展现数字的网站来说.其实实现起来很简单,只需要在includeextend.func.php加个函数即可.
更多精彩就在: 51免费论文网|www.jxszl.com
>
具体代码为:
functionclick_round_number($number,$min_value=I.000,$decimal=I.){
if($number<$min_value){
return$number;
}
$alphabets=array(I.00000000=>亿,I.0000=>万,I.000=>千);
foreach($alphabetsas$key=>$value)
if($number>=$key){
returnround($number/$key,$decimal)..$value;
}
}
调用方式为:
{dede:field.clickfunction=click_round_number(@me)/}//以调用点击数字为例
实现效果为:I.万III千IV百IIXV
原文链接:http://www.jxszl.com/biancheng/dedecms/75582.html
热门阅读