{"id":78474,"date":"2024-01-12T17:42:07","date_gmt":"2024-01-12T09:42:07","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=78474"},"modified":"2024-01-12T17:42:07","modified_gmt":"2024-01-12T09:42:07","slug":"ztmdyycj","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/78474.html","title":{"rendered":"422\u72b6\u6001\u7801\u7684\u5e94\u7528\u573a\u666f"},"content":{"rendered":"
422\u72b6\u6001\u7801\u662fHTTP\u534f\u8bae\u4e2d\u7684\u4e00\u79cd\u670d\u52a1\u5668\u72b6\u6001\u7801\uff0c\u7528\u4e8e\u6307\u793a\u670d\u52a1\u5668\u7406\u89e3\u5ba2\u6237\u7aef\u8bf7\u6c42\uff0c\u4f46\u65e0\u6cd5\u5904\u7406\u8be5\u8bf7\u6c42\u3002\u5728\u63a5\u4e0b\u6765\u7684\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u63a2\u8ba8422\u72b6\u6001\u7801\u7684\u5e94\u7528\u573a\u666f\uff0c\u5e76\u6df1\u5165\u4e86\u89e3\u5176\u5728\u5b9e\u9645\u7f51\u7edc\u901a\u4fe1\u4e2d\u7684\u4f5c\u7528\u3002<\/p>\n
422\u72b6\u6001\u7801\u662f\u6307”Unprocessable Entity”\uff0c\u8868\u793a\u670d\u52a1\u5668\u7406\u89e3\u8bf7\u6c42\u5b9e\u4f53\uff0c\u4f46\u65e0\u6cd5\u5904\u7406\u5176\u5305\u542b\u7684\u8bed\u4e49\u9519\u8bef\u3002\u8fd9\u610f\u5473\u7740\u5ba2\u6237\u7aef\u53d1\u9001\u7684\u8bf7\u6c42\u5b58\u5728\u683c\u5f0f\u6b63\u786e\u4f46\u8bed\u4e49\u4e0a\u4e0d\u7b26\u5408\u8981\u6c42\u7684\u6570\u636e\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u670d\u52a1\u5668\u65e0\u6cd5\u5904\u7406\u8be5\u8bf7\u6c42\u5e76\u8fd4\u56de422\u72b6\u6001\u7801\u3002<\/p>\n
\u4e00\u4e2a\u5e38\u89c1\u7684\u793a\u4f8b\u662f\u5728Web\u8868\u5355\u63d0\u4ea4\u8fc7\u7a0b\u4e2d\uff0c\u5ba2\u6237\u7aef\u53d1\u9001\u4e86\u4e00\u4e2a\u5305\u542b\u4e0d\u5408\u89c4\u6570\u636e\u7684\u8bf7\u6c42\uff0c\u4f8b\u5982\u7f3a\u5c11\u5fc5\u8981\u4fe1\u606f\u3001\u683c\u5f0f\u9519\u8bef\u6216\u8005\u903b\u8f91\u9519\u8bef\u3002\u5f53\u670d\u52a1\u5668\u63a5\u6536\u5230\u8fd9\u6837\u7684\u8bf7\u6c42\u65f6\uff0c\u4f1a\u8fd4\u56de422\u72b6\u6001\u7801\u4ee5\u901a\u77e5\u5ba2\u6237\u7aef\u6570\u636e\u5b58\u5728\u95ee\u9898\u3002<\/p>\n
\u5728RESTful API\u7684\u8bbe\u8ba1\u4e2d\uff0c\u6570\u636e\u9a8c\u8bc1\u662f\u4e00\u4e2a\u91cd\u8981\u7684\u73af\u8282\u3002\u5f53\u5ba2\u6237\u7aef\u5411\u670d\u52a1\u5668\u53d1\u9001\u6570\u636e\u65f6\uff0c\u670d\u52a1\u5668\u9700\u8981\u5bf9\u6570\u636e\u8fdb\u884c\u9a8c\u8bc1\uff0c\u786e\u4fdd\u5176\u7b26\u5408\u4e1a\u52a1\u89c4\u5219\u548c\u6570\u636e\u5e93\u7ea6\u675f\u3002\u5982\u679c\u670d\u52a1\u5668\u53d1\u73b0\u6570\u636e\u4e0d\u7b26\u5408\u89c4\u8303\uff0c\u53ef\u4ee5\u4f7f\u7528422\u72b6\u6001\u7801\u544a\u77e5\u5ba2\u6237\u7aef\u6570\u636e\u65e0\u6cd5\u88ab\u63a5\u53d7\u3002<\/p>\n
\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5305\u542b422\u72b6\u6001\u7801\u7684\u54cd\u5e94\u62a5\u6587\u793a\u4f8b\uff1a<\/p>\n
HTTP\/1.1 422 Unprocessable Entity<\/p>\n Content-Type: application\/json<\/p>\n {<\/p>\n \"error\": \"Unprocessable Entity\",<\/p>\n \"message\": \"The data you submitted contains errors.\"<\/p>\n }<\/p>\n <\/code><\/p>\n \u901a\u8fc7\u4e86\u89e3422\u72b6\u6001\u7801\u7684\u5e94\u7528\u573a\u666f\uff0c\u6211\u4eec\u53ef\u4ee5\u66f4\u597d\u5730\u5904\u7406\u5ba2\u6237\u7aef\u63d0\u4ea4\u7684\u6570\u636e\u9519\u8bef\uff0c\u5e76\u4e3a\u5176\u63d0\u4f9b\u6e05\u6670\u7684\u53cd\u9988\u3002\u5728\u5f00\u53d1Web\u5e94\u7528\u548cRESTful API\u65f6\uff0c\u6b63\u786e\u5730\u4f7f\u7528422\u72b6\u6001\u7801\u80fd\u591f\u63d0\u5347\u7528\u6237\u4f53\u9a8c\uff0c\u5e76\u4fc3\u8fdb\u6570\u636e\u4ea4\u4e92\u7684\u6709\u6548\u6027\u3002<\/p>\n \u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u6df1\u5165\u63a2\u8ba8\u4e86422\u72b6\u6001\u7801\u7684\u5e94\u7528\u573a\u666f\uff0c\u5206\u6790\u4e86\u5176\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\u7684\u4f5c\u7528\u3002<\/strong>\u4e86\u89e3422\u72b6\u6001\u7801\u7684\u542b\u4e49\u548c\u5e94\u7528\u80fd\u591f\u5e2e\u52a9\u6211\u4eec\u66f4\u597d\u5730\u8bbe\u8ba1\u548c\u5b9e\u73b0\u7f51\u7edc\u901a\u4fe1\u534f\u8bae\uff0c\u63d0\u9ad8\u7cfb\u7edf\u7684\u53ef\u9760\u6027\u548c\u7a33\u5b9a\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" 422\u72b6\u6001\u7801\u662fHTTP\u534f\u8bae\u4e2d\u7684\u4e00\u79cd\u670d\u52a1\u5668\u72b6\u6001\u7801\uff0c\u7528\u4e8e\u6307\u793a\u670d\u52a1\u5668\u7406\u89e3\u5ba2\u6237\u7aef\u8bf7\u6c42\uff0c\u4f46\u65e0\u6cd5\u5904\u7406\u8be5\u8bf7\u6c42\u3002\u5728\u63a5\u4e0b\u6765\u7684\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u63a2\u8ba8422\u72b6\u6001\u7801\u7684\u5e94\u7528\u573a\u666f\uff0c\u5e76\u6df1\u5165\u4e86\u89e3\u5176\u5728\u5b9e\u9645\u7f51\u7edc<\/p>\n","protected":false},"author":1,"featured_media":64183,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[259],"class_list":["post-78474","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-rs422"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/78474"}],"collection":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/comments?post=78474"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/78474\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/64183"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=78474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=78474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=78474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<\/p>\n
\u603b\u7ed3<\/h2>\n
422\u72b6\u6001\u7801\u7684\u91cd\u8981\u6027<\/h3>\n
\u6587\u7ae0\u603b\u7ed3<\/h3>\n