//字数和预计阅读时间统计函数
//根据正文内容计算出预计阅读时间
function count_words_read_time ($title,$content) {
global $post;
$text_num = mb_strlen(preg_replace('/\s/','',html_entity_decode(strip_tags($content))),'UTF-8');
//除以400,是基于百度的“普通人的平均阅读速度(300~500)字/分钟”。
$read_time = ceil($text_num/400);
$output = '本文《' . $title .'》共' . $text_num . '个字,系统预计阅读时间或需' . $read_time . '分钟。';
return $output;
}
在我们的开发过程中,往往会遇到对会员或者商家进行收益排行,分别按照当月,当周或者当日进行排序;当然,你可以先把用到的数据获取到,然后再根据你想要的功能对数据进行相应处理。下面,我要给大家演示的是直接对...