{"id":210387,"date":"2023-12-22T03:03:22","date_gmt":"2023-12-21T19:03:22","guid":{"rendered":"https:\/\/www.idc.net\/help\/210387\/"},"modified":"2023-12-22T03:03:22","modified_gmt":"2023-12-21T19:03:22","slug":"wordpress%e4%bd%bf%e7%94%a8%e6%8a%80%e5%b7%a7%ef%bc%9a%e5%87%8f%e5%b0%8fcookie%e5%a4%a7%e5%b0%8f","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/210387\/","title":{"rendered":"WordPress\u4f7f\u7528\u6280\u5de7\uff1a\u51cf\u5c0fCookie\u5927\u5c0f"},"content":{"rendered":"<p><title id=\"wordpress%e4%bd%bf%e7%94%a8%e6%8a%80%e5%b7%a7%ef%bc%9a%e5%87%8f%e5%b0%8fcookie%e5%a4%a7%e5%b0%8f-kyHBgqpSci\">WordPress\u4f7f\u7528\u6280\u5de7\uff1a\u51cf\u5c0fCookie\u5927\u5c0f<\/title><\/p>\n<h1 id=\"wordpress%e4%bd%bf%e7%94%a8%e6%8a%80%e5%b7%a7%ef%bc%9a%e5%87%8f%e5%b0%8fcookie%e5%a4%a7%e5%b0%8f-kyHBgqpSci\">WordPress\u4f7f\u7528\u6280\u5de7\uff1a\u51cf\u5c0fCookie\u5927\u5c0f<\/h1>\n<p>\u5728\u4f7f\u7528WordPress\u5efa\u7acb\u7f51\u7ad9\u65f6\uff0cCookie\u662f\u4e00\u4e2a\u91cd\u8981\u7684\u7ec4\u6210\u90e8\u5206\u3002Cookie\u662f\u7531\u670d\u52a1\u5668\u53d1\u9001\u5230\u7528\u6237\u6d4f\u89c8\u5668\u5e76\u5b58\u50a8\u5728\u7528\u6237\u8ba1\u7b97\u673a\u4e0a\u7684\u5c0f\u578b\u6587\u672c\u6587\u4ef6\u3002\u5b83\u4eec\u7528\u4e8e\u8ddf\u8e2a\u7528\u6237\u4f1a\u8bdd\u3001\u5b58\u50a8\u7528\u6237\u9996\u9009\u9879\u548c\u63d0\u4f9b\u4e2a\u6027\u5316\u5185\u5bb9\u3002\u7136\u800c\uff0c\u968f\u7740\u7f51\u7ad9\u7684\u53d1\u5c55\u548c\u529f\u80fd\u7684\u589e\u52a0\uff0cCookie\u7684\u5927\u5c0f\u53ef\u80fd\u4f1a\u53d8\u5f97\u8d8a\u6765\u8d8a\u5927\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5bf9\u7f51\u7ad9\u7684\u6027\u80fd\u548c\u52a0\u8f7d\u901f\u5ea6\u4ea7\u751f\u8d1f\u9762\u5f71\u54cd\u3002<\/p>\n<h2 id=\"%e4%b8%ba%e4%bb%80%e4%b9%88%e8%a6%81%e5%87%8f%e5%b0%8fcookie%e5%a4%a7%e5%b0%8f%ef%bc%9f-kyHBgqpSci\">\u4e3a\u4ec0\u4e48\u8981\u51cf\u5c0fCookie\u5927\u5c0f\uff1f<\/h2>\n<p>\u51cf\u5c0fCookie\u5927\u5c0f\u6709\u51e0\u4e2a\u91cd\u8981\u7684\u539f\u56e0\uff1a<\/p>\n<ul>\n<li>\u63d0\u9ad8\u7f51\u7ad9\u6027\u80fd\uff1aCookie\u7684\u5927\u5c0f\u76f4\u63a5\u5f71\u54cd\u7f51\u7ad9\u7684\u52a0\u8f7d\u901f\u5ea6\u3002\u8f83\u5927\u7684Cookie\u9700\u8981\u66f4\u957f\u7684\u65f6\u95f4\u6765\u4f20\u8f93\u5230\u7528\u6237\u7684\u6d4f\u89c8\u5668\uff0c\u4ece\u800c\u5bfc\u81f4\u7f51\u7ad9\u52a0\u8f7d\u901f\u5ea6\u53d8\u6162\u3002<\/li>\n<li>\u8282\u7701\u5e26\u5bbd\uff1a\u8f83\u5927\u7684Cookie\u9700\u8981\u66f4\u591a\u7684\u5e26\u5bbd\u6765\u4f20\u8f93\uff0c\u8fd9\u53ef\u80fd\u4f1a\u589e\u52a0\u7f51\u7ad9\u7684\u8fd0\u8425\u6210\u672c\u3002<\/li>\n<li>\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\uff1a\u5feb\u901f\u52a0\u8f7d\u7684\u7f51\u7ad9\u53ef\u4ee5\u63d0\u4f9b\u66f4\u597d\u7684\u7528\u6237\u4f53\u9a8c\uff0c\u800c\u8f83\u6162\u7684\u7f51\u7ad9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u7528\u6237\u6d41\u5931\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%a6%82%e4%bd%95%e5%87%8f%e5%b0%8fcookie%e5%a4%a7%e5%b0%8f%ef%bc%9f-kyHBgqpSci\">\u5982\u4f55\u51cf\u5c0fCookie\u5927\u5c0f\uff1f<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u51cf\u5c0fCookie\u5927\u5c0f\u7684\u6280\u5de7\uff1a<\/p>\n<h3 id=\"1-%e5%88%a0%e9%99%a4%e4%b8%8d%e5%bf%85%e8%a6%81%e7%9a%84cookie-kyHBgqpSci\">1. \u5220\u9664\u4e0d\u5fc5\u8981\u7684Cookie<\/h3>\n<p>\u68c0\u67e5\u60a8\u7684\u7f51\u7ad9\u5e76\u5220\u9664\u4e0d\u518d\u9700\u8981\u7684Cookie\u3002\u6709\u65f6\u5019\uff0c\u63d2\u4ef6\u6216\u4e3b\u9898\u53ef\u80fd\u4f1a\u6dfb\u52a0\u4e00\u4e9b\u4e0d\u5fc5\u8981\u7684Cookie\uff0c\u8fd9\u4e9bCookie\u53ef\u80fd\u4f1a\u589e\u52a0\u7f51\u7ad9\u7684\u8d1f\u8f7d\u3002\u53ea\u4fdd\u7559\u5fc5\u8981\u7684Cookie\u53ef\u4ee5\u51cf\u5c0fCookie\u7684\u5927\u5c0f\u3002<\/p>\n<h3 id=\"2-%e5%87%8f%e5%b0%8fcookie%e7%9a%84%e8%bf%87%e6%9c%9f%e6%97%b6%e9%97%b4-kyHBgqpSci\">2. \u51cf\u5c0fCookie\u7684\u8fc7\u671f\u65f6\u95f4<\/h3>\n<p>Cookie\u7684\u8fc7\u671f\u65f6\u95f4\u51b3\u5b9a\u4e86\u5b83\u4eec\u5728\u7528\u6237\u8ba1\u7b97\u673a\u4e0a\u5b58\u50a8\u7684\u65f6\u95f4\u957f\u5ea6\u3002\u5c06Cookie\u7684\u8fc7\u671f\u65f6\u95f4\u8bbe\u7f6e\u4e3a\u8f83\u77ed\u7684\u65f6\u95f4\u53ef\u4ee5\u51cf\u5c0fCookie\u7684\u5927\u5c0f\u3002\u53ea\u6709\u5728\u5fc5\u8981\u7684\u60c5\u51b5\u4e0b\u624d\u5c06Cookie\u7684\u8fc7\u671f\u65f6\u95f4\u8bbe\u7f6e\u4e3a\u8f83\u957f\u7684\u65f6\u95f4\u3002<\/p>\n<h3 id=\"3-%e5%8e%8b%e7%bc%a9cookie%e7%9a%84%e5%80%bc-kyHBgqpSci\">3. \u538b\u7f29Cookie\u7684\u503c<\/h3>\n<p>\u5bf9\u4e8e\u5b58\u50a8\u8f83\u957f\u6587\u672c\u6216\u5927\u91cf\u6570\u636e\u7684Cookie\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528\u538b\u7f29\u7b97\u6cd5\u6765\u51cf\u5c0fCookie\u7684\u5927\u5c0f\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528Gzip\u6216Deflate\u7b97\u6cd5\u5bf9Cookie\u7684\u503c\u8fdb\u884c\u538b\u7f29\uff0c\u7136\u540e\u5728\u670d\u52a1\u5668\u548c\u6d4f\u89c8\u5668\u4e4b\u95f4\u8fdb\u884c\u89e3\u538b\u7f29\u3002<\/p>\n<h3 id=\"4-%e4%bd%bf%e7%94%a8%e5%ad%90%e5%9f%9f%e5%90%8d%e6%9d%a5%e5%88%86%e5%8f%91cookie-kyHBgqpSci\">4. \u4f7f\u7528\u5b50\u57df\u540d\u6765\u5206\u53d1Cookie<\/h3>\n<p>\u5c06Cookie\u5206\u53d1\u5230\u591a\u4e2a\u5b50\u57df\u540d\u53ef\u4ee5\u51cf\u5c0f\u5355\u4e2aCookie\u7684\u5927\u5c0f\u3002\u901a\u8fc7\u5c06Cookie\u5206\u53d1\u5230\u4e0d\u540c\u7684\u5b50\u57df\u540d\uff0c\u53ef\u4ee5\u5c06Cookie\u7684\u5927\u5c0f\u5206\u6563\u5230\u591a\u4e2a\u8bf7\u6c42\u4e2d\uff0c\u4ece\u800c\u51cf\u5c0f\u6bcf\u4e2a\u8bf7\u6c42\u4e2d\u7684Cookie\u5927\u5c0f\u3002<\/p>\n<h3 id=\"5-%e4%bd%bf%e7%94%a8http-only%e5%92%8csecure%e6%a0%87%e5%bf%97-kyHBgqpSci\">5. \u4f7f\u7528HTTP Only\u548cSecure\u6807\u5fd7<\/h3>\n<p>\u4f7f\u7528HTTP Only\u548cSecure\u6807\u5fd7\u53ef\u4ee5\u589e\u52a0Cookie\u7684\u5b89\u5168\u6027\uff0c\u5e76\u51cf\u5c0fCookie\u7684\u5927\u5c0f\u3002HTTP Only\u6807\u5fd7\u53ef\u4ee5\u9632\u6b62\u901a\u8fc7JavaScript\u8bbf\u95eeCookie\uff0c\u800cSecure\u6807\u5fd7\u53ef\u4ee5\u786e\u4fddCookie\u53ea\u901a\u8fc7HTTPS\u8fde\u63a5\u4f20\u8f93\u3002<\/p>\n<h2 id=\"%e7%bb%93%e8%ae%ba-kyHBgqpSci\">\u7ed3\u8bba<\/h2>\n<p>\u51cf\u5c0fCookie\u5927\u5c0f\u662f\u63d0\u9ad8\u7f51\u7ad9\u6027\u80fd\u548c\u7528\u6237\u4f53\u9a8c\u7684\u91cd\u8981\u6b65\u9aa4\u3002\u901a\u8fc7\u5220\u9664\u4e0d\u5fc5\u8981\u7684Cookie\u3001\u51cf\u5c0fCookie\u7684\u8fc7\u671f\u65f6\u95f4\u3001\u538b\u7f29Cookie\u7684\u503c\u3001\u4f7f\u7528\u5b50\u57df\u540d\u6765\u5206\u53d1Cookie\u4ee5\u53ca\u4f7f\u7528HTTP Only\u548cSecure\u6807\u5fd7\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u51cf\u5c0fCookie\u7684\u5927\u5c0f\u3002\u8fd9\u4e9b\u6280\u5de7\u53ef\u4ee5\u5e2e\u52a9\u60a8\u7684WordPress\u7f51\u7ad9\u66f4\u5feb\u5730\u52a0\u8f7d\uff0c\u5e76\u63d0\u4f9b\u66f4\u597d\u7684\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n<h2 id=\"%e9%a6%99%e6%b8%af%e6%9c%8d%e5%8a%a1%e5%99%a8%e9%a6%96%e9%80%89%e5%90%8e%e6%b5%aa%e4%ba%91-kyHBgqpSci\">\u9999\u6e2f\u670d\u52a1\u5668\u9996\u9009\u540e\u6d6a\u4e91<\/h2>\n<p>\u540e\u6d6a\u4e91\u662f\u4e00\u5bb6\u4e13\u4e1a\u7684\u4e91\u8ba1\u7b97\u516c\u53f8\uff0c\u63d0\u4f9b\u9999\u6e2f\u670d\u52a1\u5668\u3001\u7f8e\u56fd\u670d\u52a1\u5668\u548c\u4e91\u670d\u52a1\u5668\u7b49\u4ea7\u54c1\u3002\u4f5c\u4e3a\u9999\u6e2f\u670d\u52a1\u5668\u7684\u9996\u9009\u54c1\u724c\uff0c\u540e\u6d6a\u4e91\u63d0\u4f9b\u9ad8\u6027\u80fd\u3001\u7a33\u5b9a\u53ef\u9760\u7684\u670d\u52a1\u5668\u89e3\u51b3\u65b9\u6848\u3002\u60a8\u53ef\u4ee5\u8bbf\u95ee<a href=\"https:\/\/idc.net\">\u540e\u6d6a\u4e91\u5b98\u7f51<\/a>\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u9999\u6e2f\u670d\u52a1\u5668\u7684\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u4f7f\u7528\u6280\u5de7\uff1a\u51cf\u5c0fCookie\u5927\u5c0f WordPress\u4f7f\u7528\u6280\u5de7\uff1a\u51cf\u5c0fCookie\u5927\u5c0f \u5728\u4f7f\u7528Wo [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[],"class_list":["post-210387","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/210387","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=210387"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/210387\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=210387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=210387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=210387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}