{"id":170059,"date":"2020-01-21T08:40:03","date_gmt":"2020-01-21T00:40:03","guid":{"rendered":"https:\/\/gulass.cn\/?p=170059"},"modified":"2020-01-13T13:18:39","modified_gmt":"2020-01-13T05:18:39","slug":"get-and-post","status":"publish","type":"post","link":"https:\/\/gulass.cn\/get-and-post.html","title":{"rendered":"HTTP \u8bf7\u6c42\u65b9\u6cd5\uff1aGET \u548c POST"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u4e24\u79cd\u6700\u5e38\u7528\u7684 HTTP \u65b9\u6cd5\u662f\uff1aGET \u548c POST\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u4ec0\u4e48\u662f HTTP \uff1f<\/strong><\/div>\n

\u8d85\u6587\u672c\u4f20\u8f93\u534f\u8bae\uff08HTTP\uff09\u7684\u8bbe\u8ba1\u76ee\u7684\u662f\u4fdd\u8bc1\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u901a\u4fe1\u3002<\/p>\n

HTTP \u7684\u5de5\u4f5c\u65b9\u5f0f\u662f\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u8bf7\u6c42-\u5e94\u7b54\u534f\u8bae\u3002<\/p>\n

web \u6d4f\u89c8\u5668\u53ef\u80fd\u662f\u5ba2\u6237\u7aef\uff0c\u800c\u8ba1\u7b97\u673a\u4e0a\u7684\u7f51\u7edc\u5e94\u7528\u7a0b\u5e8f\u4e5f\u53ef\u80fd\u4f5c\u4e3a\u670d\u52a1\u5668\u7aef\u3002<\/p>\n

\u4e3e\u4f8b\uff1a\u5ba2\u6237\u7aef\uff08\u6d4f\u89c8\u5668\uff09\u5411\u670d\u52a1\u5668\u63d0\u4ea4 HTTP \u8bf7\u6c42\uff1b\u670d\u52a1\u5668\u5411\u5ba2\u6237\u7aef\u8fd4\u56de\u54cd\u5e94\u3002\u54cd\u5e94\u5305\u542b\u5173\u4e8e\u8bf7\u6c42\u7684\u72b6\u6001\u4fe1\u606f\u4ee5\u53ca\u53ef\u80fd\u88ab\u8bf7\u6c42\u7684\u5185\u5bb9\u3002<\/p>\n

\u4e24\u79cd HTTP \u8bf7\u6c42\u65b9\u6cd5\uff1aGET \u548c POST<\/strong><\/div>\n
    \n
  • GET<\/b> - \u4ece\u6307\u5b9a\u7684\u8d44\u6e90\u8bf7\u6c42\u6570\u636e\u3002<\/li>\n
  • POST<\/b> - \u5411\u6307\u5b9a\u7684\u8d44\u6e90\u63d0\u4ea4\u8981\u88ab\u5904\u7406\u7684\u6570\u636e\u3002<\/li>\n<\/ul>\n
    GET \u65b9\u6cd5<\/strong><\/div>\n

    \u8bf7\u6ce8\u610f\uff0c\u67e5\u8be2\u5b57\u7b26\u4e32\uff08\u540d\u79f0\/\u503c\u5bf9\uff09\u662f\u5728 GET \u8bf7\u6c42\u7684 URL \u4e2d\u53d1\u9001\u7684\uff1a<\/strong><\/p>\n

    \/test\/demo_form.php?name1=value1&name2=value2<\/pre>\n

    \u6709\u5173 GET \u8bf7\u6c42\u7684\u5176\u4ed6\u4e00\u4e9b\u6ce8\u91ca\uff1a<\/strong><\/p>\n

      \n
    • GET \u8bf7\u6c42\u53ef\u88ab\u7f13\u5b58<\/li>\n
    • GET \u8bf7\u6c42\u4fdd\u7559\u5728\u6d4f\u89c8\u5668\u5386\u53f2\u8bb0\u5f55\u4e2d<\/li>\n
    • GET \u8bf7\u6c42\u53ef\u88ab\u6536\u85cf\u4e3a\u4e66\u7b7e<\/li>\n
    • GET \u8bf7\u6c42\u4e0d\u5e94\u5728\u5904\u7406\u654f\u611f\u6570\u636e\u65f6\u4f7f\u7528<\/li>\n
    • GET \u8bf7\u6c42\u6709\u957f\u5ea6\u9650\u5236<\/li>\n
    • GET \u8bf7\u6c42\u53ea\u5e94\u5f53\u7528\u4e8e\u53d6\u56de\u6570\u636e<\/li>\n<\/ul>\n
      POST \u65b9\u6cd5<\/strong><\/div>\n

      \u8bf7\u6ce8\u610f\uff0c\u67e5\u8be2\u5b57\u7b26\u4e32\uff08\u540d\u79f0\/\u503c\u5bf9\uff09\u662f\u5728 POST \u8bf7\u6c42\u7684 HTTP \u6d88\u606f\u4e3b\u4f53\u4e2d\u53d1\u9001\u7684\uff1a<\/strong><\/p>\n

      POST \/test\/demo_form.php HTTP\/1.1\r\nHost: runoob.com\r\nname1=value1&name2=value2<\/pre>\n

      \u6709\u5173 POST \u8bf7\u6c42\u7684\u5176\u4ed6\u4e00\u4e9b\u6ce8\u91ca\uff1a<\/strong><\/p>\n

        \n
      • POST \u8bf7\u6c42\u4e0d\u4f1a\u88ab\u7f13\u5b58<\/li>\n
      • POST \u8bf7\u6c42\u4e0d\u4f1a\u4fdd\u7559\u5728\u6d4f\u89c8\u5668\u5386\u53f2\u8bb0\u5f55\u4e2d<\/li>\n
      • POST \u4e0d\u80fd\u88ab\u6536\u85cf\u4e3a\u4e66\u7b7e<\/li>\n
      • POST \u8bf7\u6c42\u5bf9\u6570\u636e\u957f\u5ea6\u6ca1\u6709\u8981\u6c42<\/li>\n<\/ul>\n
        \u6bd4\u8f83 GET \u4e0e POST<\/strong><\/div>\n

        \u4e0b\u9762\u7684\u8868\u683c\u6bd4\u8f83\u4e86\u4e24\u79cd HTTP \u65b9\u6cd5\uff1aGET \u548c POST\u3002<\/p>\n\n\n\n\n\n\n\n\n\n\n\n\n
         <\/th>\nGET<\/th>\nPOST<\/th>\n<\/tr>\n
        \u540e\u9000\u6309\u94ae\/\u5237\u65b0<\/td>\n\u65e0\u5bb3<\/td>\n\u6570\u636e\u4f1a\u88ab\u91cd\u65b0\u63d0\u4ea4\uff08\u6d4f\u89c8\u5668\u5e94\u8be5\u544a\u77e5\u7528\u6237\u6570\u636e\u4f1a\u88ab\u91cd\u65b0\u63d0\u4ea4\uff09\u3002<\/td>\n<\/tr>\n
        \u4e66\u7b7e<\/td>\n\u53ef\u6536\u85cf\u4e3a\u4e66\u7b7e<\/td>\n\u4e0d\u53ef\u6536\u85cf\u4e3a\u4e66\u7b7e<\/td>\n<\/tr>\n
        \u7f13\u5b58<\/td>\n\u80fd\u88ab\u7f13\u5b58<\/td>\n\u4e0d\u80fd\u7f13\u5b58<\/td>\n<\/tr>\n
        \u7f16\u7801\u7c7b\u578b<\/td>\napplication\/x-www-form-urlencoded<\/td>\napplication\/x-www-form-urlencoded or multipart\/form-data\u3002\u4e3a\u4e8c\u8fdb\u5236\u6570\u636e\u4f7f\u7528\u591a\u91cd\u7f16\u7801\u3002<\/td>\n<\/tr>\n
        \u5386\u53f2<\/td>\n\u53c2\u6570\u4fdd\u7559\u5728\u6d4f\u89c8\u5668\u5386\u53f2\u4e2d\u3002<\/td>\n\u53c2\u6570\u4e0d\u4f1a\u4fdd\u5b58\u5728\u6d4f\u89c8\u5668\u5386\u53f2\u4e2d\u3002<\/td>\n<\/tr>\n
        \u5bf9\u6570\u636e\u957f\u5ea6\u7684\u9650\u5236<\/td>\n\u662f\u7684\u3002\u5f53\u53d1\u9001\u6570\u636e\u65f6\uff0cGET \u65b9\u6cd5\u5411 URL \u6dfb\u52a0\u6570\u636e\uff1bURL \u7684\u957f\u5ea6\u662f\u53d7\u9650\u5236\u7684\uff08URL \u7684\u6700\u5927\u957f\u5ea6\u662f 2048 \u4e2a\u5b57\u7b26\uff09\u3002<\/td>\n\u65e0\u9650\u5236\u3002<\/td>\n<\/tr>\n
        \u5bf9\u6570\u636e\u7c7b\u578b\u7684\u9650\u5236<\/td>\n\u53ea\u5141\u8bb8 ASCII \u5b57\u7b26\u3002<\/td>\n\u6ca1\u6709\u9650\u5236\u3002\u4e5f\u5141\u8bb8\u4e8c\u8fdb\u5236\u6570\u636e\u3002<\/td>\n<\/tr>\n
        \u5b89\u5168\u6027<\/td>\n\u4e0e POST \u76f8\u6bd4\uff0cGET \u7684\u5b89\u5168\u6027\u8f83\u5dee\uff0c\u56e0\u4e3a\u6240\u53d1\u9001\u7684\u6570\u636e\u662f URL \u7684\u4e00\u90e8\u5206\u3002<\/p>\n

        \t\u5728\u53d1\u9001\u5bc6\u7801\u6216\u5176\u4ed6\u654f\u611f\u4fe1\u606f\u65f6\u7edd\u4e0d\u8981\u4f7f\u7528 GET \uff01<\/td>\n

        POST \u6bd4 GET \u66f4\u5b89\u5168\uff0c\u56e0\u4e3a\u53c2\u6570\u4e0d\u4f1a\u88ab\u4fdd\u5b58\u5728\u6d4f\u89c8\u5668\u5386\u53f2\u6216 web \u670d\u52a1\u5668\u65e5\u5fd7\u4e2d\u3002<\/td>\n<\/tr>\n
        \u53ef\u89c1\u6027<\/td>\n\u6570\u636e\u5728 URL \u4e2d\u5bf9\u6240\u6709\u4eba\u90fd\u662f\u53ef\u89c1\u7684\u3002<\/td>\n\u6570\u636e\u4e0d\u4f1a\u663e\u793a\u5728 URL \u4e2d\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
        \u5176\u4ed6 HTTP \u8bf7\u6c42\u65b9\u6cd5<\/strong><\/div>\n

        \u4e0b\u9762\u7684\u8868\u683c\u5217\u51fa\u4e86\u5176\u4ed6\u4e00\u4e9b HTTP \u8bf7\u6c42\u65b9\u6cd5\uff1a<\/p>\n\n\n\n\n\n\n\n\n
        \u65b9\u6cd5<\/th>\n\u63cf\u8ff0<\/th>\n<\/tr>\n
        HEAD<\/td>\n\u4e0e GET \u76f8\u540c\uff0c\u4f46\u53ea\u8fd4\u56de HTTP \u62a5\u5934\uff0c\u4e0d\u8fd4\u56de\u6587\u6863\u4e3b\u4f53\u3002<\/td>\n<\/tr>\n
        PUT<\/td>\n\u4e0a\u4f20\u6307\u5b9a\u7684 URI \u8868\u793a\u3002<\/td>\n<\/tr>\n
        DELETE<\/td>\n\u5220\u9664\u6307\u5b9a\u8d44\u6e90\u3002<\/td>\n<\/tr>\n
        OPTIONS<\/td>\n\u8fd4\u56de\u670d\u52a1\u5668\u652f\u6301\u7684 HTTP \u65b9\u6cd5\u3002<\/td>\n<\/tr>\n
        CONNECT<\/td>\n\u628a\u8bf7\u6c42\u8fde\u63a5\u8f6c\u6362\u5230\u900f\u660e\u7684 TCP\/IP \u901a\u9053\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"

        \u8d85\u6587\u672c\u4f20\u8f93\u534f\u8bae\uff08HTTP\uff09\u7684\u8bbe\u8ba1\u76ee\u7684\u662f\u4fdd\u8bc1\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u901a\u4fe1\u3002 HTTP \u7684\u5de5\u4f5c\u65b9\u5f0f\u662f\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u4e4b\u95f4 […]<\/p>\n","protected":false},"author":1481,"featured_media":170061,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-170059","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/170059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/1481"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=170059"}],"version-history":[{"count":5,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/170059\/revisions"}],"predecessor-version":[{"id":170351,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/170059\/revisions\/170351"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/170061"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=170059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=170059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=170059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}