{"id":59785,"date":"2025-04-23T13:09:41","date_gmt":"2025-04-23T05:09:41","guid":{"rendered":"https:\/\/fwq.ai\/blog\/59785\/"},"modified":"2025-04-23T13:09:41","modified_gmt":"2025-04-23T05:09:41","slug":"ecshop%e9%9a%8f%e6%84%8f%e8%b0%83%e7%94%a8%e8%87%aa%e5%ae%9a%e4%b9%89%e5%b1%9e%e6%80%a7","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/59785\/","title":{"rendered":"ecshop\u968f\u610f\u8c03\u7528\u81ea\u5b9a\u4e49\u5c5e\u6027"},"content":{"rendered":"<p>\u5728\u7f51\u5e97\u7a0b\u5e8fecshop\u4e2d\u968f\u610f\u8c03\u7528\u81ea\u5b9a\u4e49\u5c5e\u6027\u65b9\u6cd5\u3002<br \/>\n <\/p>\n<p> goods.php<br \/> \u627e\u5230<br \/> $properties = get_goods_properties($goods_id); \/\/ \u83b7\u5f97\u5546\u54c1\u7684\u89c4\u683c\u548c\u5c5e\u6027<br \/> \u6211\u7684229\u884c<\/p>\n<p> \u589e\u52a0\u4ee5\u4e0b\u4ee3\u7801<\/p>\n<p> \/\/\u81ea\u5b9a\u4e49\u5c5e\u6027\u6570\u636e\u7ed3\u6784<\/p>\n<pre>\r\n if($properties['pro']){\r\n            $myprolist = $properties['pro']['Attribute'];\r\n            $mypro = array();\r\n            foreach ($myprolist as $key =&gt; $v) {\r\n                $name = $v['name'];\r\n                $mypro[$name] = $v['value'];\r\n            }\r\n        }\r\n&nbsp;\r\n\t$smarty-&gt;assign('mypro',          $mypro);                              \/\/ \u5546\u54c1\u5c5e\u6027<\/pre>\n<p> \/*<br \/> array(2) {<br \/> [&#8220;Shape&#8221;]=&gt;<br \/> string(5) \u201cRound\u201d<br \/> [&#8220;Length&#8221;]=&gt;<br \/> string(4) \u201c52mm\u201d<br \/> }<br \/> *\/<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/www.ldhost.cn\/helphmb\/uploads\/allimg\/161213\/1F011G30-0.jpg\" class=\"aligncenter\" title=\"ecshop\u968f\u610f\u8c03\u7528\u81ea\u5b9a\u4e49\u5c5e\u6027\u63d2\u56fe\" alt=\"ecshop\u968f\u610f\u8c03\u7528\u81ea\u5b9a\u4e49\u5c5e\u6027\u63d2\u56fe\" \/><\/p>\n<p> \u5728goods.dwt\u6a21\u677f\u91cc\uff0c\u5c31\u53ef\u4ee5\u5728\u4efb\u610f\u7684\u5730\u65b9\u8c03\u7528\u81ea\u5df1\u60f3\u8c03\u7528\u7684\u5c5e\u6027\u4e86\u3002<\/p>\n<pre>\r\n   {$mypro.Length}<\/pre>\n<p> \u6700\u540e\u7684\u6700\u540e\uff0c\u4f60\u5c31\u80fd\u968f\u610f\u8bbe\u8ba1\u81ea\u5df1\u7684\u5c5e\u6027\u754c\u9762\u4e86\u3002\u6bd4\u5982<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/www.ldhost.cn\/helphmb\/uploads\/allimg\/161213\/1F011I34-1.jpg\" class=\"aligncenter\" title=\"ecshop\u968f\u610f\u8c03\u7528\u81ea\u5b9a\u4e49\u5c5e\u6027\u63d2\u56fe1\" alt=\"ecshop\u968f\u610f\u8c03\u7528\u81ea\u5b9a\u4e49\u5c5e\u6027\u63d2\u56fe1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u7f51\u5e97\u7a0b\u5e8fecshop\u4e2d\u968f\u610f\u8c03\u7528\u81ea\u5b9a\u4e49\u5c5e\u6027\u65b9\u6cd5\u3002 goods.php \u627e\u5230 $properties = get_goods_properties($goods_id); \/\/ \u83b7\u5f97\u5546\u54c1\u7684\u89c4\u683c\u548c\u5c5e\u6027 \u6211\u7684229\u884c \u589e\u52a0\u4ee5\u4e0b\u4ee3\u7801 \/\/\u81ea\u5b9a\u4e49\u5c5e\u6027\u6570\u636e\u7ed3\u6784 if($properties[&#8216;pro&#8217;]){ $myprolist = $properties[&#8216;pro&#8217;][&#8216;Attribute&#8217;]; $mypro = array(); foreach ($myprolist as $key =&gt; $v) { $name = $v[&#8216;name&#8217;]; $mypro[$name] = $v[&#8216;value&#8217;]; } } &nbsp; $smarty-&gt;assign(&#8216;mypro&#8217;, $mypro); \/\/ \u5546\u54c1\u5c5e\u6027 \/* array(2) { [&#8220;Shape&#8221;]=&gt; string(5) \u201cRound\u201d [&#8220;Length&#8221;]=&gt; string(4) \u201c52mm\u201d } *\/ \u5728goods.dwt\u6a21\u677f\u91cc\uff0c\u5c31\u53ef\u4ee5\u5728\u4efb\u610f\u7684\u5730\u65b9\u8c03\u7528\u81ea\u5df1\u60f3\u8c03\u7528\u7684\u5c5e\u6027\u4e86\u3002 {$mypro.Length} \u6700\u540e\u7684\u6700\u540e\uff0c\u4f60\u5c31\u80fd\u968f\u610f\u8bbe\u8ba1\u81ea\u5df1\u7684\u5c5e\u6027\u754c\u9762\u4e86\u3002\u6bd4\u5982<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-59785","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/59785","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=59785"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/59785\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=59785"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=59785"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=59785"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}