]+href\s*=\s*['\"]([^'\"]+)['\"][^>]*>/", $pageLink, $matches);
- if(isset($matches[1])){
+ if (isset($matches[1])) {
return $matches[1];
}
return "#";
+}
+
+/**
+ * 统计文章字数
+ *
+ * @param $cid
+ */
+function articleCount($cid)
+{
+ $db = Typecho_Db::get();
+ $rs = $db->fetchRow($db->select('table.contents.text')->from('table.contents')->where('table.contents.cid=?', $cid)->order('table.contents.cid', Typecho_Db::SORT_ASC)->limit(1));
+ $text = preg_replace("/[^\x{4e00}-\x{9fa5}]/u", "", $rs['text']);
+ return mb_strlen($text, 'UTF-8');
}
\ No newline at end of file
diff --git a/post.php b/post.php
index 9bd7719..316a1ea 100644
--- a/post.php
+++ b/post.php
@@ -40,7 +40,8 @@ $this->need('base/article.style.php');
modified)) ;?>
文章字数:
- 75
+// echo $this->cid;?>
+ cid));?>
阅读时长: 1 分