{"id":10006094,"date":"2022-08-03T09:15:16","date_gmt":"2022-08-03T01:15:16","guid":{"rendered":"https:\/\/ityet.com\/?p=10006094"},"modified":"2022-08-03T09:15:16","modified_gmt":"2022-08-03T01:15:16","slug":"%e9%9d%a2%e8%af%95%e7%aa%81%e5%87%bb71%ef%bc%9aget-%e5%92%8c-post-%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10006094","title":{"rendered":"\u9762\u8bd5\u7a81\u51fb71\uff1aGET \u548c POST \u6709\u4ec0\u4e48\u533a\u522b\uff1f"},"content":{"rendered":"<p>GET \u548c POST \u662f HTTP \u8bf7\u6c42\u4e2d\u6700\u5e38\u7528\u7684\u4e24\u79cd\u8bf7\u6c42\u65b9\u6cd5\uff0c\u5728\u65e5\u5e38\u5f00\u53d1\u7684 RESTful \u63a5\u53e3\u4e2d\uff0c\u90fd\u80fd\u770b\u5230\u5b83\u4eec\u7684\u8eab\u5f71\u3002\u800c\u5b83\u4eec\u4e4b\u95f4\u7684\u533a\u522b\uff0c\u4e5f\u662f\u4e00\u9053\u5e38\u89c1\u4e14\u7ecf\u5178\u7684\u9762\u8bd5\u9898\uff0c\u6240\u4ee5\u6211\u4eec\u672c\u6587\u5c31\u6765\u8be6\u7ec6\u7684\u804a\u804a\u3002<br \/>HTTP \u534f\u8bae\u5b9a\u4e49\u7684\u65b9\u6cd5\u7c7b\u578b\u603b\u5171\u6709\u4ee5\u4e0b 10 \u79cd\uff1a<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042261393\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<blockquote><p>PS\uff1a\u76ee\u524d\u5927\u90e8\u5206\u7684\u7f51\u7ad9\u4f7f\u7528\u7684\u90fd\u662f HTTP 1.1 \u7684\u534f\u8bae\u3002<\/p><\/blockquote>\n<p>\u4f46\u5728\u65e5\u5e38\u5f00\u53d1\u4e2d\uff0c\u4f7f\u7528\u9891\u7387\u6700\u9ad8\u7684\u5c31\u5c5e GET \u8bf7\u6c42\u548c POST \u8bf7\u6c42\u4e86\uff0c\u5c24\u5176\u662f\u5728\u4e2d\u3001\u5c0f\u578b\u516c\u53f8\uff0c\u57fa\u672c\u53ea\u4f1a\u4f7f\u7528\u8fd9\u4e24\u79cd\u8bf7\u6c42\u6765\u5b9e\u73b0\u4e00\u4e2a\u9879\u76ee\u3002<\/p>\n<h2>1.\u76f8\u540c\u70b9\u548c\u6700\u672c\u8d28\u7684\u533a\u522b<\/h2>\n<h3>1.1 \u76f8\u540c\u70b9<\/h3>\n<p>GET \u8bf7\u6c42\u548c POST \u8bf7\u6c42\u5e95\u5c42\u90fd\u662f\u57fa\u4e8e TCP\/IP \u534f\u8bae\u5b9e\u73b0\u7684\uff0c\u4f7f\u7528\u4e8c\u8005\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\uff0c\u90fd\u53ef\u4ee5\u5b9e\u73b0\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u7aef\u7684\u53cc\u5411\u4ea4\u4e92\u3002<\/p>\n<h3>1.2 \u6700\u672c\u8d28\u7684\u533a\u522b<\/h3>\n<p><strong>GET \u548c POST \u6700\u672c\u8d28\u7684\u533a\u522b\u662f\u201c\u7ea6\u5b9a\u548c\u89c4\u8303\u201d\u4e0a\u7684\u533a\u522b\uff0c\u5728\u89c4\u8303\u4e2d\uff0c\u5b9a\u4e49 GET \u8bf7\u6c42\u662f\u7528\u6765\u83b7\u53d6\u8d44\u6e90\u7684\uff0c\u4e5f\u5c31\u662f\u8fdb\u884c\u67e5\u8be2\u64cd\u4f5c\u7684\uff0c\u800c POST \u8bf7\u6c42\u662f\u7528\u6765\u4f20\u8f93\u5b9e\u4f53\u5bf9\u8c61\u7684\uff0c\u56e0\u6b64\u4f1a\u4f7f\u7528 POST \u6765\u8fdb\u884c\u6dfb\u52a0\u3001\u4fee\u6539\u548c\u5220\u9664\u7b49\u64cd\u4f5c<\/strong>\u3002<br \/>\u5f53\u7136\u5982\u679c\u4e25\u683c\u6309\u7167\u89c4\u8303\u6765\u8bf4\uff0c\u5220\u9664\u64cd\u4f5c\u5e94\u8be5\u4f7f\u7528 DELETE \u8bf7\u6c42\u624d\u5bf9\uff0c\u4f46\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\uff0c\u4f7f\u7528 POST \u6765\u8fdb\u884c\u5220\u9664\u7684\u7528\u6cd5\u66f4\u5e38\u89c1\u4e00\u4e9b\u3002<br \/><strong>\u6309\u7167\u7ea6\u5b9a\u6765\u8bf4\uff0cGET \u548c POST \u7684\u53c2\u6570\u4f20\u9012\u4e5f\u662f\u4e0d\u540c\u7684\uff0cGET \u8bf7\u6c42\u662f\u5c06\u53c2\u6570\u62fc\u52a0\u5230 URL \u4e0a\u8fdb\u884c\u53c2\u6570\u4f20\u9012\u7684\uff0c\u800c POST \u662f\u5c06\u8bf7\u53c2\u6570\u5199\u5165\u5230\u8bf7\u6c42\u6b63\u6587\u4e2d\u4f20\u9012\u7684<\/strong>\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042261394\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h2>2.\u975e\u672c\u8d28\u533a\u522b<\/h2>\n<h3>2.1 \u7f13\u5b58\u4e0d\u540c<\/h3>\n<p>GET \u8bf7\u6c42\u4e00\u822c\u4f1a\u88ab\u7f13\u5b58\uff0c\u6bd4\u5982\u5e38\u89c1\u7684 CSS\u3001JS\u3001HTML \u8bf7\u6c42\u7b49\u90fd\u4f1a\u88ab\u7f13\u5b58\uff1b\u800c POST \u8bf7\u6c42\u9ed8\u8ba4\u662f\u4e0d\u8fdb\u884c\u7f13\u5b58\u7684\u3002<\/p>\n<h3>2.2 \u53c2\u6570\u957f\u5ea6\u9650\u5236\u4e0d\u540c<\/h3>\n<p>GET \u8bf7\u6c42\u7684\u53c2\u6570\u662f\u901a\u8fc7 URL \u4f20\u9012\u7684\uff0c\u800c URL \u7684\u957f\u5ea6\u662f\u6709\u9650\u5236\u7684\uff0c\u901a\u5e38\u4e3a 2k\uff0c\u5f53\u7136\u6d4f\u89c8\u5668\u5382\u5546\u4e0d\u540c\u3001\u7248\u672c\u4e0d\u540c\u8fd9\u4e2a\u9650\u5236\u7684\u5927\u5c0f\u503c\u53ef\u80fd\u4e5f\u4e0d\u540c\uff0c\u4f46\u76f8\u540c\u7684\u662f\u5b83\u4eec\u90fd\u4f1a\u5bf9 URL \u7684\u5927\u5c0f\u8fdb\u884c\u9650\u5236\uff1b\u800c POST \u8bf7\u6c42\u53c2\u6570\u662f\u5b58\u653e\u5728\u8bf7\u6c42\u6b63\u6587\uff08request body\uff09\u4e2d\u7684\uff0c\u6240\u4ee5\u6ca1\u6709\u5927\u5c0f\u9650\u5236\u3002<\/p>\n<h3>2.3 \u56de\u9000\u548c\u5237\u65b0\u4e0d\u540c<\/h3>\n<p>GET \u8bf7\u6c42\u53ef\u4ee5\u76f4\u63a5\u8fdb\u884c\u56de\u9000\u548c\u5237\u65b0\uff0c\u4e0d\u4f1a\u5bf9\u7528\u6237\u548c\u7a0b\u5e8f\u4ea7\u751f\u4efb\u4f55\u5f71\u54cd\uff1b\u800c POST \u8bf7\u6c42\u5982\u679c\u76f4\u63a5\u56de\u6eda\u548c\u5237\u65b0\u5c06\u4f1a\u628a\u6570\u636e\u518d\u6b21\u63d0\u4ea4\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042261395\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>2.4 \u5386\u53f2\u8bb0\u5f55\u4e0d\u540c<\/h3>\n<p>GET \u8bf7\u6c42\u7684\u53c2\u6570\u4f1a\u4fdd\u5b58\u5728\u5386\u53f2\u8bb0\u5f55\u4e2d\uff0c\u800c POST \u8bf7\u6c42\u7684\u53c2\u6570\u4e0d\u4f1a\u4fdd\u7559\u5230\u5386\u53f2\u8bb0\u5f55\u4e2d\u3002<\/p>\n<h3>2.5 \u4e66\u7b7e\u4e0d\u540c<\/h3>\n<p>GET \u8bf7\u6c42\u7684\u5730\u5740\u53ef\u88ab\u6536\u85cf\u4e3a\u4e66\u7b7e\uff0c\u800c POST \u8bf7\u6c42\u7684\u5730\u5740\u4e0d\u80fd\u88ab\u6536\u85cf\u4e3a\u4e66\u7b7e\u3002<\/p>\n<h2>\u603b\u7ed3<\/h2>\n<p>GET \u548c POST \u662f HTTP \u8bf7\u6c42\u4e2d\u6700\u5e38\u7528\u7684\u4e24\u79cd\u8bf7\u6c42\u65b9\u6cd5\uff0c\u5b83\u4eec\u7684\u5e95\u5c42\u90fd\u662f\u57fa\u4e8e TCP\/IP \u5b9e\u73b0\u7684\u3002\u5b83\u4eec\u7684\u533a\u522b\u4e3b\u8981\u4f53\u73b0\u5728 5 \u4e2a\u65b9\u9762\uff1a\u7f13\u5b58\u4e0d\u540c\u3001\u53c2\u6570\u957f\u5ea6\u9650\u5236\u4e0d\u540c\u3001\u56de\u9000\u548c\u5237\u65b0\u4e0d\u540c\u3001\u5386\u53f2\u8bb0\u5f55\u4e0d\u540c\u3001\u80fd\u5426\u4fdd\u5b58\u4e3a\u4e66\u7b7e\u4e0d\u540c\uff0c\u4f46\u5b83\u4eec\u6700\u5927\u7684\u533a\u522b\u662f\u89c4\u8303\u548c\u7ea6\u5b9a\u4e0a\u7684\u4e0d\u540c\uff0c\u89c4\u8303\u4e2d\u5b9a\u4e49 GET \u662f\u7528\u6765\u83b7\u53d6\u4fe1\u606f\u7684\uff0c\u800c POST \u662f\u7528\u6765\u4f20\u9012\u5b9e\u4f53\u7684\uff0c\u5e76\u4e14 GET \u8bf7\u6c42\u7684\u53c2\u6570\u8981\u653e\u5728 URL \u4e0a\uff0c\u800c POST \u8bf7\u6c42\u7684\u53c2\u6570\u8981\u653e\u5728\u8bf7\u6c42\u6b63\u6587\u4e2d\u3002<\/p>\n<h4>\u53c2\u8003 &#038; \u9e23\u8c22<\/h4>\n<p>www.w3school.com.cn\/tags\/html_ref_httpmethods.asp<\/p>\n<blockquote>\n<p>\u662f\u975e\u5ba1\u4e4b\u4e8e\u5df1\uff0c\u6bc1\u8a89\u542c\u4e4b\u4e8e\u4eba\uff0c\u5f97\u5931\u5b89\u4e4b\u4e8e\u6570\u3002<\/p>\n<p>\u516c\u4f17\u53f7\uff1aJava\u9762\u8bd5\u771f\u9898\u89e3\u6790<\/p>\n<p>\u9762\u8bd5\u5408\u96c6\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=tn583Z5NODaQ%2B6WNGdKnrw%3D%3D.x6D2Fre5xVfYipmG%2BK1LVCesEvbmk7YQO9BaScLWLKzhkkSG1HgB7fDr7JOIndFn\" rel=\"nofollow\">https:\/\/gitee.com\/mydb\/interview<\/a><\/p>\n<\/blockquote>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000042261391\">https:\/\/segmentfault.com\/a\/1190000042261391<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>GET \u548c POST \u662f HTTP \u8bf7\u6c42\u4e2d\u6700\u5e38\u7528\u7684\u4e24\u79cd\u8bf7\u6c42\u65b9\u6cd5\uff0c\u5728\u65e5\u5e38\u5f00\u53d1\u7684 RESTful \u63a5\u53e3\u4e2d\uff0c\u90fd\u80fd\u770b\u5230 [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-10006094","post","type-post","status-publish","format-standard","hentry"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10006094"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006094\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10006094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10006094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10006094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}