{"id":199511,"date":"2025-05-03T09:51:54","date_gmt":"2025-05-03T01:51:54","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199511\/"},"modified":"2025-05-03T09:51:54","modified_gmt":"2025-05-03T01:51:54","slug":"%e5%9c%a8ecshop%e9%a6%96%e9%a1%b5%e6%98%be%e7%a4%ba%e6%9c%80%e6%96%b0%e7%9a%84%e8%af%84%e8%ae%ba","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199511\/","title":{"rendered":"\u5728ECSHOP\u9996\u9875\u663e\u793a\u6700\u65b0\u7684\u8bc4\u8bba"},"content":{"rendered":"<p> \u5982\u679c\u60f3\u5728ecshop\u9996\u9875\u663e\u793a\u6700\u65b0\u7684\u8bc4\u8bba\uff0cecshop\u9ed8\u8ba4\u7684\u529f\u80fd\u5e76\u6ca1\u6709\u8fd9\u4e2a\u8bbe\u7f6e\uff0c\u9700\u8981\u6211\u4eec\u4e8c\u6b21\u5f00\u53d1\u7cfb\u7edf\u6587\u4ef6\uff0c\u4e0b\u9762\u4ee5ECSHOP2.7.2\u5b98\u65b9\u9ed8\u8ba4\u7684\u6a21\u7248\u4e3a\u4f8b\uff0c\u7ed9\u5927\u5bb6\u8bb2\u89e3\u4e00\u4e0b\u5982\u4f55\u5728ECSHOP\u9996\u9875\u663e\u793a\u6700\u65b0\u7684\u8bc4\u8bba\uff0c\u5982\u679c\u4f60\u4f7f\u7528\u7684\u5176\u4ed6\u7248\u672c\u7684ecshop\uff0c\u5e94\u8be5\u53ef\u4ee5\u6309\u7167\u672c\u6587\u7684\u7684\u65b9\u6cd5\u4fee\u6539\u5bf9\u5e94\u7684\u4ee3\u7801\uff0c\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\u3002<\/p>\n<h2> \u9884\u89c8\u6548\u679c<\/h2>\n<p> <img decoding=\"async\" src=\"https:\/\/www.uedsc.com\/wp-content\/uploads\/2014\/12\/new-comment.jpg\" class=\"aligncenter\"><\/p>\n<h2> \u65b0\u5efa\u5e93\u6587\u4ef6<\/h2>\n<p> \u7531\u4e8eecshop\u9ed8\u8ba4\u7684\u529f\u80fd\u6ca1\u6709\u8fd9\u4e2a\u8bbe\u7f6e\uff0c\u6240\u4ee5\u6211\u4eec\u5fc5\u987b\u81ea\u5df1\u65b0\u5efa\u4e00\u4e2a\u5e93\u6587\u4ef6\uff0c\u5728\u6a21\u7248\u7684lib\u6587\u4ef6\u5939\u4e0b\u9762\uff0c\u547d\u540d\u4e3aindex_comments.lbi\uff0c\u7136\u540e\u5728\u6587\u4ef6\u4e2d\u52a0\u5165\u5982\u4e0b\u4ee3\u7801\u3002<\/p>\n<pre>\r\n&lt;?php\r\nif(!function_exists(\"get_comments\")){\r\nfunction get_comments($num)\r\n{\r\n$sql = 'SELECT * FROM '. $GLOBALS['ecs']-&gt;table('comment') .\r\n&nbsp;&nbsp; &nbsp;' WHERE status = 1 AND parent_id = 0 and comment_type=0 '.\r\n&nbsp;&nbsp; &nbsp;' ORDER BY add_time DESC';\r\nif ($num &gt; 0)\r\n{\r\n$sql .= ' LIMIT ' . $num;\r\n}\r\n\/\/echo $sql;\r\n\r\n$res = $GLOBALS['db']-&gt;getAll($sql);\r\n$comments = array();\r\nforeach ($res AS $idx =&gt; $row)\r\n{\r\n$comments[$idx]['add_time']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = $comments[$idx]['add_time']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = local_date\r\n($GLOBALS['_CFG']['time_format'], $row['add_time']);\r\n$comments[$idx]['user_name']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = $row['user_name'];\r\n$comments[$idx]['content']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = $row['content'];\r\n$comments[$idx]['id_value']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = $row['id_value'];\r\n}\r\nreturn $comments;\r\n}\r\n}\r\n$GLOBALS['smarty']-&gt;assign('my_comments',get_comments(10)); \/\/ 10\u6761\u6570\u636e\r\n?&gt;\r\n&lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\"&gt;\r\n&lt;!-- \u6700\u65b0\u8bc4\u8bba__Begin --&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;\r\n&lt;div class=\"box_2\"&gt;\r\n&lt;h3&gt;&lt;span&gt;\u6700\u65b0\u8bc4\u8bba&lt;\/span&gt;&lt;\/h3&gt;\r\n&lt;div class=\"top10List clearfix\"&gt;\r\n&lt;!--{foreach from=$my_comments item=comments}--&gt;\r\n&lt;ul class=\"clearfix\"&gt;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;\r\n&lt;li style=\"padding:5px 10px;\"&gt;\r\n&lt;a href=\"goods.php?id={$comments.id_value}\" target=\"_blank\"&gt;\r\n{$comments.content|truncate:21:\"\"}&lt;\/a&gt;&lt;br \/&gt;\r\n{$comments.add_time}\r\n&lt;\/li&gt;\r\n&lt;\/ul&gt;\r\n&lt;!--{\/foreach}--&gt;\r\n&lt;\/div&gt;\r\n&lt;\/div&gt;<\/pre>\n<h2> \u8c03\u7528\u5e93\u6587\u4ef6<\/h2>\n<p> \u5728ECSHOP\u9996\u9875\u6a21\u677f\u6587\u4ef6\u4e2d\uff0c\u8c03\u7528\u8fd9\u4e2a\u5e93\u6587\u4ef6\uff0c\u6253\u5f00 themes\/default\/index.dwt \u6587\u4ef6\u5728<\/p>\n<pre>\r\n&lt;\/div&gt;\r\n&nbsp; &lt;!--left end--&gt;<\/pre>\n<p> \u4e0a\u9762\u589e\u52a0\u4e00\u884c\u8c03\u7528\u4ee3\u7801<\/p>\n<pre>\r\n&lt;!-- #BeginLibraryItem \"\/library\/index_comments.lbi\" --&gt;&nbsp; &lt;!-- #EndLibraryItem --&gt;<\/pre>\n<p> \u767b\u5f55\u5546\u57ce\u540e\u53f0\uff0c\u6e05\u7406\u4e00\u4e0b\u7f13\u5b58\uff0c\u6d4f\u89c8\u9996\u9875\u5373\u53ef\u770b\u5230\u5728\u5de6\u4e0b\u89d2\u663e\u793a\u4e86\u6700\u65b0\u7684\u8bc4\u8bba\u5185\u5bb9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u60f3\u5728ecshop\u9996\u9875\u663e\u793a\u6700\u65b0&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-199511","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=199511"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199511\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}