{"id":7401,"date":"2013-11-23T20:34:29","date_gmt":"2013-11-23T12:34:29","guid":{"rendered":"http:\/\/www.yptk.cn\/index.php\/2013\/11\/23\/%e6%9c%80%e5%85%a8%e7%9a%84emlog%e7%bb%9f%e8%ae%a1%e4%bb%a3%e7%a0%81\/"},"modified":"2013-11-23T20:34:29","modified_gmt":"2013-11-23T12:34:29","slug":"%e6%9c%80%e5%85%a8%e7%9a%84emlog%e7%bb%9f%e8%ae%a1%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"http:\/\/yptk.cn\/index.php\/2013\/11\/23\/%e6%9c%80%e5%85%a8%e7%9a%84emlog%e7%bb%9f%e8%ae%a1%e4%bb%a3%e7%a0%81\/","title":{"rendered":"\u6700\u5168\u7684emlog\u7edf\u8ba1\u4ee3\u7801"},"content":{"rendered":"<pre class=\"prettyprint lang-php linenums\">&lt;?php\n\/\/\u7edf\u8ba1\u6587\u7ae0\u603b\u6570\nfunction count_log_all(){\n$db = MySql::getInstance();\n$data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"blog WHERE type = 'blog'\");\nreturn $data['total'];\n}\n\/\/\u7f6e\u9876\u6587\u7ae0\u6570\nfunction count_log_top(){\n$db = MySql::getInstance();\n$data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"blog WHERE top = 'y' or sortop = 'y' AND type = 'blog'\");\n return $data['total'];\n}\n\/\/\u9690\u85cf\u6587\u7ae0\u6570\nfunction count_log_hide(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"blog WHERE hide = 'y' AND type = 'blog'\"); return $data['total']; }\n\/\/\u672a\u5ba1\u6838\u6587\u7ae0\u6570\nfunction count_log_check(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"blog WHERE checked = 'n' AND type = 'blog'\"); return $data['total']; }\n\/\/\u52a0\u5bc6\u6587\u7ae0\u6570\nfunction count_log_pass(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"blog WHERE password !='' AND type = 'blog'\"); return $data['total']; }\n\/\/\u7edf\u8ba1\u9875\u9762\u603b\u6570\nfunction count_page_all(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"blog WHERE type = 'page'\"); return $data['total']; }\n\/\/\u7edf\u8ba1\u8bc4\u8bba\u603b\u6570\nfunction count_com_all(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"comment\"); return $data['total']; }\n \/\/\u7edf\u8ba1\u53cb\u94fe\u603b\u6570\nfunction count_link_all(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"link\"); return $data['total']; }\n\/\/\u7edf\u8ba1\u5fae\u8bed\u8bc4\u8bba\u603b\u6570\nfunction count_treply_all(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"reply\"); return $data['total']; }\n\/\/\u7edf\u8ba1\u5206\u7c7b\u603b\u6570\nfunction count_sort_all(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"sort\"); return $data['total']; }\n\/\/\u7edf\u8ba1\u5b50\u5206\u7c7b\u6570\nfunction count_sort_mod(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"sort WHERE pid != 0\"); return $data['total']; }\n\/\/\u7edf\u8ba1\u6807\u7b7e\u603b\u6570\nfunction count_tag_all(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"tag\"); return $data['total']; }\n\/\/\u7edf\u8ba1\u5fae\u8bed\u603b\u6570\nfunction count_tw_all(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"twitter\"); return $data['total']; }\n\/\/\u7edf\u8ba1\u7528\u6237\u603b\u6570\nfunction count_user_all(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"user\"); return $data['total']; }\n\/\/\u7edf\u8ba1\u7ba1\u7406\u5458\u603b\u6570\nfunction count_user_admin(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"user WHERE role = 'admin'\"); return $data['total']; }\n\/\/\u7edf\u8ba1\u4f5c\u8005\u603b\u6570\nfunction count_user_writer(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"user WHERE role = 'writer'\"); return $data['total']; }\n\/\/\u7edf\u8ba1\u9644\u4ef6\u603b\u6570\nfunction count_att_all(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"attachment\"); return $data['total']; }\n\/\/\u6700\u540e\u53d1\u8868\u6587\u7ae0\u65f6\u95f4\nfunction last_post_log(){ $db = MySql::getInstance(); $sql = \"SELECT * FROM \" . DB_PREFIX . \"blog WHERE type='blog' ORDER BY date DESC LIMIT 0,1\"; $res = $db-&gt;query($sql); $row = $db-&gt;fetch_array($res); $date = date('Y-n-j H:i',$row['date']); return $date; }?&gt;<\/pre>\n<p>\u4f7f\u7528\u65b9\u6cd5\u7535\u8111\u7248\uff0c\u5c06\u4ee5\u4e0a\u4ee3\u7801\u590d\u5236\u5230module.php\u4e2d\uff0c\u624b\u673a\u7248\u590d\u5236\u7c98\u5e16\u5230index.php\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u5728\u4efb\u610f\u9875\u9762\u4f7f\u7528\u8c03\u7528\uff0c\u4f8b\u5982\u9700\u8981\u5728\u4fa7\u8fb9\u680f\u663e\u793a\u65e5\u5fd7\u603b\u6570\uff0c\u90a3\u4e48\u5c31\u9700\u8981\u5728side.php\u4e2d\u6dfb\u52a0\u8c03\u7528\u4ee3\u7801\uff0c\u4ee3\u7801\u6dfb\u52a0\u5728\u4f60\u60f3\u8981\u663e\u793a\u7684\u5730\u65b9\uff0c\u8c03\u7528\u4ee3\u7801\u4e3a\uff1a<br \/>\n&lt;?php echo \u65b9\u6cd5\u540d; ?&gt;<br \/>\n\u4f8b\u5982\uff1a<\/p>\n<pre class=\"prettyprint lang-php linenums\">&lt;?php echo count_com_all(); ?&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&lt;?php \/\/\u7edf\u8ba1\u6587\u7ae0\u603b\u6570 function count_log_all(){ $db = MySql::getInstance(); $data = $db-&gt;once_fetch_array(&#8220;SELECT COUNT(*) AS total FROM &#8221; . DB_PREFIX . &#8220;blog WHERE type = &#8216;blog'&#8221;); return $data[&#8216;total [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[15],"tags":[],"class_list":["post-7401","post","type-post","status-publish","format-standard","hentry","category-15"],"_links":{"self":[{"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/posts\/7401","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/comments?post=7401"}],"version-history":[{"count":0,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/posts\/7401\/revisions"}],"wp:attachment":[{"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/media?parent=7401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/categories?post=7401"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/tags?post=7401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}