{"id":199258,"date":"2025-05-03T08:29:40","date_gmt":"2025-05-03T00:29:40","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199258\/"},"modified":"2025-05-03T08:29:40","modified_gmt":"2025-05-03T00:29:40","slug":"%e8%ae%a9ecshop%e9%a6%96%e9%a1%b5%e7%83%ad%e6%90%9c%e5%85%b3%e9%94%ae%e8%af%8d%e9%9a%8f%e6%9c%ba%e5%87%ba%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199258\/","title":{"rendered":"\u8ba9ecshop\u9996\u9875\u70ed\u641c\u5173\u952e\u8bcd\u968f\u673a\u51fa\u73b0"},"content":{"rendered":"<p>ecshop\u7684\u641c\u7d22\u5173\u952e\u8bcd\u529f\u80fd\u6bd4\u8f83\u7b80\u5355\uff0c\u6211\u4eec\u60f3\u8ba9\u5173\u952e\u8bcd\u52a8\u6001\u53d8\u5316\uff0c\u8be5\u5982\u4f55\u64cd\u4f5c\uff1f \u4ee5\u4e0b\u597d\u6a21\u677f\u63d0\u4f9b\u7684ECSHOP\u6559\u7a0b\uff1a<\/p>\n<p>&nbsp;1\u3001\u627e\u5230 include\/lib_main.php\uff081652\uff09<\/p>\n<p>  \u5220\u9664\u8fd9\u4e2a\u91cc\u9762\u7684\u4ee3\u7801:   &nbsp;   if (!empty($GLOBALS[&#8216;_CFG&#8217;][&#8216;search_keywords&#8217;]))   &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; $searchkeywords = explode(&#8216;,&#8217;, trim($GLOBALS[&#8216;_CFG&#8217;][&#8216;search_keywords&#8217;]));   &nbsp; &nbsp; }   &nbsp; &nbsp; else   &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; $searchkeywords = array();   &nbsp; &nbsp; }   &nbsp; &nbsp; $smarty-&gt;assign(&#8216;searchkeywords&#8217;, $searchkeywords);   2 \u6253\u5f00 include\/lib_insert.php \u5728\u6700\u540e\u52a0\u5165\u8fd9\u4e2a\u4e00\u4e2a\u51fd\u6570   &nbsp;   &nbsp;   function insert_searchkeywords() {   &nbsp; &nbsp; if (!empty($GLOBALS[&#8216;_CFG&#8217;][&#8216;search_keywords&#8217;]))   &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; $searchkeywords = explode(&#8216;,&#8217;, trim($GLOBALS[&#8216;_CFG&#8217;][&#8216;search_keywords&#8217;]));   &nbsp; &nbsp; &nbsp; &nbsp; $rand = array_rand($searchkeywords,3);\/\/\u540e\u9762\u7684 3 \u662f\u8bbe\u7f6e\u663e\u793a\u7684\u6570\u91cf   &nbsp; &nbsp; &nbsp; &nbsp; for($i=0;$i&lt;3;$i++) {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $search[] = $searchkeywords[$rand[$i]];   &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; $searchkeywords = $search;   &nbsp; &nbsp; }   &nbsp; &nbsp; else   &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; $searchkeywords = array();   &nbsp; &nbsp; }   &nbsp; &nbsp; $GLOBALS[&#8216;smarty&#8217;]-&gt;assign(&#8216;searchkeywords&#8217;, $searchkeywords);   &nbsp; &nbsp; $val = $GLOBALS[&#8216;smarty&#8217;]-&gt;fetch(&#8216;library\/search.lbi&#8217;);\/\/ &nbsp;\u8fd9\u91cc\u8981\u5728\u4f60\u7684\u6a21\u677f\u91cc\u9762\u521b\u5efa\u4e00\u4e2asearch.lbi   &nbsp; &nbsp; return $val;   }   3 .\u5728\u4f60\u7684 \u6a21\u677f\u91cc\u9762\u521b\u5efa\u4e00\u4e2a search.lbi \u7684\u6587\u4ef6   &nbsp;   {if $searchkeywords}   &nbsp; &nbsp;{$lang.hot_search} \uff1a   &nbsp; &nbsp;{foreach from=$searchkeywords item=val}   &nbsp; &nbsp;&lt;a href=&#8221;search.php?keywords={$val|escape:url}&#8221;&gt;{$val}&lt;\/a&gt;   &nbsp; &nbsp;{\/foreach}   &nbsp; &nbsp;{\/if}   4. \u5927\u5f00\u4f60\u6a21\u677f\u4e0b\u9762 page_header.lbi \u627e\u5230 \u4ee3\u7801\u66ff\u6362   &nbsp;   {if $searchkeywords}   &nbsp; &nbsp;{$lang.hot_search} \uff1a   &nbsp; &nbsp;{foreach from=$searchkeywords item=val}   &nbsp; &nbsp;&lt;a href=&#8221;search.php?keywords={$val|escape:url}&#8221;&gt;{$val}&lt;\/a&gt;   &nbsp; &nbsp;{\/foreach}   &nbsp; &nbsp;{\/if}   &nbsp;   \/\/\u628a\u4f60\u6a21\u677f\u91cc\u9762\u7684\u8fd9\u4e2a\u4ee3\u7801\u66ff\u6362\u6210 &nbsp;   &nbsp;   {insert name=&#8217;searchkeywords&#8217;}   \u5176\u5b9e\u5230\u8fd9\u91cc\u4f60\u53ef\u4ee5\u53d1\u73b0\uff0c \u5176\u5b9e\u5c31\u662f\u628a page_header.lbi \u91cc\u9762\u7684\u6587\u4ef6\u62ff\u5230\u4e86 search.lbi   &nbsp;   \u8fd9\u6837\u4e0a\u4f20\u4ee3\u7801\uff0c\u7136\u540e\u6e05\u695a\u4f60\u7684 \u7f13\u5b58\uff0c \u5237\u65b0\uff0c \u8bd5\u8bd5\u770b\u770b\u6bcf\u6b21\u770b\u5230\u7684\u70ed\u641c\u5173\u952e\u8bcd\u662f\u4e00\u6837\u7684\u5417\uff1f\uff01 <\/p>\n","protected":false},"excerpt":{"rendered":"<p>ecshop\u7684\u641c\u7d22\u5173\u952e\u8bcd\u529f\u80fd\u6bd4\u8f83&#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-199258","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199258","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=199258"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199258\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}