{"id":199155,"date":"2025-05-03T08:56:46","date_gmt":"2025-05-03T00:56:46","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199155\/"},"modified":"2025-05-03T08:56:46","modified_gmt":"2025-05-03T00:56:46","slug":"ecshop%e9%a6%96%e9%a1%b5%e8%b0%83%e7%94%a8%e6%9c%80%e6%96%b0%e8%af%84%e8%ae%ba%e6%8f%92%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199155\/","title":{"rendered":"ECSHOP\u9996\u9875\u8c03\u7528\u6700\u65b0\u8bc4\u8bba\u63d2\u4ef6"},"content":{"rendered":"<p> ECSHOP\u9996\u9875\u8c03\u7528\u6700\u65b0\u8bc4\u8bba\u63d2\u4ef6\uff0c\u597d\u6a21\u677f\u63d0\u4f9b\u5982\u4e0b\u4fee\u6539\u4ee3\u7801\uff1a<\/p>\n<p><span style=\"border-collapse: collapse;font-family: Verdana, Helvetica, Arial, sans-serif;line-height: normal\"> <\/span><\/p>\n<ol>\n<li>&lt;?php<\/li>\n<li>if(!function_exists(&#8220;get_comments&#8221;)){<\/li>\n<li>function get_comments($num)<\/li>\n<li>{<\/li>\n<li>$sql = &#8216;SELECT a.*,b.goods_id,b.goods_thumb,b.goods_name FROM &#8216;. $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;comment&#8217;) .<\/li>\n<li>&#8216; AS a,&#8217;. $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) .&#8217;AS b WHERE a.status = 1 AND a.parent_id = 0 and a.comment_type=0 and&nbsp;<\/li>\n<li>&nbsp;<\/li>\n<li>a.id_value=b.goods_id &#8216;.<\/li>\n<li>&#8216; ORDER BY a.add_time DESC&#8217;;<\/li>\n<li>if ($num &gt; 0)<\/li>\n<li>{<\/li>\n<li>$sql .= &#8216; LIMIT &#8216; . $num;<\/li>\n<li>}<\/li>\n<li>\/\/echo $sql;<\/li>\n<li>&nbsp;<\/li>\n<li>$res = $GLOBALS[&#8216;db&#8217;]-&gt;getAll($sql);<\/li>\n<li>$comments = array();<\/li>\n<li>foreach ($res AS $idx =&gt; $row)<\/li>\n<li>{<\/li>\n<li>$comments[$idx][&#8216;add_time&#8217;] = local_date($GLOBALS[&#8216;_CFG&#8217;][&#8216;time_format&#8217;], $row[&#8216;add_time&#8217;]);<\/li>\n<li>$comments[$idx][&#8216;content&#8217;] = $row[&#8216;content&#8217;];<\/li>\n<li>$comments[$idx][&#8216;id_value&#8217;] = $row[&#8216;id_value&#8217;];<\/li>\n<li>$comments[$idx][&#8216;goods_thumb&#8217;] = get_image_path($row[&#8216;goods_id&#8217;], $row[&#8216;goods_thumb&#8217;], true);<\/li>\n<li>$comments[$idx][&#8216;goods_name&#8217;] = $row[&#8216;goods_name&#8217;];<\/li>\n<li>}<\/li>\n<li>return $comments;<\/li>\n<li>}<\/li>\n<li>}<\/li>\n<li>?&gt;<\/li>\n<li>&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text\/html; charset=utf-8&#8243;&gt;<\/li>\n<li>&lt;!&#8211;<span style=\"line-height: normal;cursor: pointer;border-bottom-width: 1px;border-bottom-style: solid\">\u6570\u636e<\/span>\u8c03\u7528-\u6700\u65b0\u8bc4\u8bba\u5f00\u59cb &#8211;&gt;&nbsp;<\/li>\n<li>&lt;?php<\/li>\n<li>$this-&gt;assign(&#8216;my_comments&#8217;,get_comments(5)); \/\/ \u6570\u636e\u6761\u6570<\/li>\n<li>?&gt;<\/li>\n<li>&lt;!&#8211;{foreach from=$my_comments item=comments}&#8211;&gt;<\/li>\n<li>&lt;table width=&#8221;290&#8243; border=&#8221;0&#8243; cellspacing=&#8221;0&#8243; cellpadding=&#8221;0&#8243; style=&#8221; border-bottom:1px #ccc dashed;&#8221;&gt;<\/li>\n<li>&lt;tr&gt;<\/li>\n<li>&lt;td width=&#8221;73&#8243; height=&#8221;70&#8243; align=&#8221;center&#8221;&gt;&lt;a href=&#8221;goods.php?id={$comments.id_value}&#8221; target=&#8221;_blank&#8221;&gt;&lt;img&nbsp;<\/li>\n<li>&nbsp;<\/li>\n<li>src=&#8221;{$comments.goods_thumb}&#8221; border=&#8221;0&#8243; width=&#8221;60&#8243; height=&#8221;60&#8243; style=&#8221; border:1px #CCCCCC solid;&#8221;\/&gt;&lt;\/a&gt;&lt;\/td&gt;<\/li>\n<li>&lt;td width=&#8221;473&#8243; align=&#8221;left&#8221; valign=&#8221;top&#8221;&gt;<\/li>\n<li>&lt;div style=&#8221;height:3px; overflow:hidden;&#8221;&gt; &lt;\/div&gt;<\/li>\n<li>&lt;div&gt;&lt;a href=&#8221;goods.php?id={$comments.id_value}&#8221; target=&#8221;_blank&#8221;&gt;&lt;font style=&#8221; color:#FF0000; font-size:14px;&#8221;&gt;<\/li>\n<li>&nbsp;<\/li>\n<li>{$comments.goods_name}&lt;\/font&gt;&lt;\/a&gt;&lt;\/div&gt;<\/li>\n<li>&lt;div&gt;&lt;img src=&#8221;..\/images\/pl.gif&#8221; width=&#8221;38&#8243; height=&#8221;19&#8243; align=&#8221;absmiddle&#8221;&gt;{$comments.content|truncate:100:&#8221;&#8221;}&lt;\/div&gt;<\/li>\n<li>&lt;div style=&#8221;color:#999999;&#8221;&gt;<span style=\"line-height: normal;cursor: pointer;border-bottom-width: 1px;border-bottom-style: solid\">\u65f6\u95f4<\/span>\uff1a{$comments.add_time}&lt;\/div&gt;<\/li>\n<li>&lt;\/td&gt;<\/li>\n<li>&lt;\/tr&gt;<\/li>\n<li>&lt;\/table&gt;<\/li>\n<li>&lt;!&#8211;{\/foreach}&#8211;&gt;<\/li>\n<\/ol>\n<p>\u6b64\u5904\uff1a<\/p>\n<\/p>\n<ol>\n<li>&lt;?php<\/li>\n<li>&nbsp;<\/li>\n<li>$this-&gt;assign(&#8216;my_comments&#8217;,get_comments(5)); \/\/ \u6570\u636e\u6761\u6570&nbsp; &nbsp;\u8fd9\u91cc\u76845 \u662f\u4f60\u8981\u8c03\u7528\u7684\u6570\u91cf\u3002\u3002\u3002<\/li>\n<li>&nbsp;<\/li>\n<li>?&gt;<\/li>\n<\/ol><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ECSHOP\u9996\u9875\u8c03\u7528\u6700\u65b0\u8bc4\u8bba\u63d2\u4ef6&#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-199155","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199155","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=199155"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199155\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}