//字数统计
function allOfCharacters() {
$chars=0;
$db=Typecho_Db::get();
$select=$db ->select(‘text’)->from(‘table.contents’);
$rows=$db->fetchAll($select);
foreach ($rows as $row) { $chars +=mb_strlen(trim($row[‘text’]), ‘UTF-8′); }
$unit=”;
if($chars >=10000) { $chars /=10000; $unit=’w’; }
else if($chars >=1000) { $chars /=1000; $unit=’k’; }
$out=sprintf(‘%.2lf %s’,$chars, $unit);
return $out;
}
function allOfCharacters() {
$chars=0;
$db=Typecho_Db::get();
$select=$db ->select(‘text’)->from(‘table.contents’);
$rows=$db->fetchAll($select);
foreach ($rows as $row) { $chars +=mb_strlen(trim($row[‘text’]), ‘UTF-8′); }
$unit=”;
if($chars >=10000) { $chars /=10000; $unit=’w’; }
else if($chars >=1000) { $chars /=1000; $unit=’k’; }
$out=sprintf(‘%.2lf %s’,$chars, $unit);
return $out;
}
© 版权声明
文章版权归作者所有,未经允许请勿转载。