{"id":199250,"date":"2025-05-03T08:14:52","date_gmt":"2025-05-03T00:14:52","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199250\/"},"modified":"2025-05-03T08:14:52","modified_gmt":"2025-05-03T00:14:52","slug":"%e8%a7%a3%e5%86%b3ecshop%e8%b4%ad%e7%89%a9%e6%97%b6%e8%87%aa%e5%8a%a8%e9%80%80%e5%87%ba%e7%9a%84%e5%8a%9e%e6%b3%95","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199250\/","title":{"rendered":"\u89e3\u51b3ecshop\u8d2d\u7269\u65f6\u81ea\u52a8\u9000\u51fa\u7684\u529e\u6cd5"},"content":{"rendered":"<p><span style=\"font-family: Tahoma, Helvetica, \u5b8b\u4f53, san-serif;line-height: 28px\">&nbsp;ecshop\u7684session\u673a\u5236\u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u4f46\u4e5f\u6709\u4e00\u4e9b\u7455\u75b5\uff0c\u90e8\u5206\u4f1a\u5458\u5728\u64cd\u4f5c\u65f6\u53ef\u80fd\u4f1a\u51fa\u73b0\u767b\u5f55\u540e\u81ea\u52a8\u9000\u51fa\u6216\u5546\u54c1\u65e0\u6cd5\u52a0\u5165\u8d2d\u8f66\u6216\u8d2d\u7269\u8f66\u81ea\u52a8\u6e05\u7a7a\u7b49\u60c5\u51b5\uff0c\u8fd9\u4e2a\u4e00\u65b9\u9762<\/span><\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;font-family: Tahoma, Helvetica, \u5b8b\u4f53, san-serif;line-height: 28px\">\u5982\u662f\u662f\u56e0\u4e3a\u7528\u4ee3\u7406\u4e0a\u7f51\uff0cip\u4e0d\u65ad\u53d8\u5316\uff0c\u53ef\u4ee5\u53c2\u8003\u7684\u89e3\u51b3\u65b9\u6cd5\uff0c\u53e6\u5916\u4e5f\u53ef\u4ee5\u6253\u5f00includes\\cls_session.php\u627e\u5230<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;font-family: Tahoma, Helvetica, \u5b8b\u4f53, san-serif;line-height: 28px\">&nbsp;function gen_session_key($session_id)<br \/> &nbsp;&nbsp;&nbsp; {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; static $ip = &#8221;;<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;font-family: Tahoma, Helvetica, \u5b8b\u4f53, san-serif;line-height: 28px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($ip == &#8221;)<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ip = substr($this-&gt;_ip, 0, strrpos($this-&gt;_ip, &#8216;.&#8217;));<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;font-family: Tahoma, Helvetica, \u5b8b\u4f53, san-serif;line-height: 28px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return sprintf(&#8216;%08x&#8217;, crc32(!empty($_SERVER[&#8216;HTTP_USER_AGENT&#8217;]) ? $_SERVER[&#8216;HTTP_USER_AGENT&#8217;] . ROOT_PATH . $ip . $session_id : ROOT_PATH . $ip . $session_id));<br \/> &nbsp; }<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;font-family: Tahoma, Helvetica, \u5b8b\u4f53, san-serif;line-height: 28px\">\u66ff\u6362\u6210<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;font-family: Tahoma, Helvetica, \u5b8b\u4f53, san-serif;line-height: 28px\">&nbsp;<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;font-family: Tahoma, Helvetica, \u5b8b\u4f53, san-serif;line-height: 28px\">function gen_session_key($session_id)<br \/> &nbsp;&nbsp;&nbsp; {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; static $ip = &#8221;;<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;font-family: Tahoma, Helvetica, \u5b8b\u4f53, san-serif;line-height: 28px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($ip == &#8221;)<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ip = substr($this-&gt;_ip, 0, strrpos($this-&gt;_ip, &#8216;.&#8217;));<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;font-family: Tahoma, Helvetica, \u5b8b\u4f53, san-serif;line-height: 28px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return sprintf(&#8216;%08x&#8217;, crc32(ROOT_PATH . $ip . $session_id));<br \/> &nbsp;&nbsp;&nbsp; }<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;font-family: Tahoma, Helvetica, \u5b8b\u4f53, san-serif;line-height: 28px\">\u5c31\u53ef\u4ee5\u4e86<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;ecshop\u7684ses&#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-199250","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199250","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=199250"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199250\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}