{"id":101025,"date":"2020-05-21T17:41:19","date_gmt":"2020-05-21T09:41:19","guid":{"rendered":"http:\/\/4563.org\/?p=101025"},"modified":"2020-05-21T17:41:19","modified_gmt":"2020-05-21T09:41:19","slug":"%e4%b8%ba%e4%bb%80%e4%b9%88%e6%88%91%e7%9a%84%e8%a1%a8%e5%8d%95-post-%e4%ba%86%e4%b8%80%e4%b8%aa%e6%95%b0%e5%ad%97%ef%bc%8c%e5%90%8e%e5%8f%b0%e6%8e%a5%e6%94%b6%e5%88%b0%e4%b9%8b%e5%90%8e%e5%8f%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=101025","title":{"rendered":"\u4e3a\u4ec0\u4e48\u6211\u7684\u8868\u5355 post \u4e86\u4e00\u4e2a\u6570\u5b57\uff0c\u540e\u53f0\u63a5\u6536\u5230\u4e4b\u540e\u53d8\u6210\u4e86 string\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u4e3a\u4ec0\u4e48\u6211\u7684\u8868\u5355 post \u4e86\u4e00\u4e2a\u6570\u5b57\uff0c\u540e\u53f0\u63a5\u6536\u5230\u4e4b\u540e\u53d8\u6210\u4e86 string\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Waihinchan <\/span>  <span><i><\/i> 1<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>html \u662f\u8fd9\u4e48\u4e2a\u5199\u6cd5\uff1a<\/p>\n<pre><code>&lt;form action=\"gamepage\" method=\"post\" &gt;     Player name: &lt;input type=\"text\" name=player_id value=\"player1\"&gt;&lt;br&gt;     Room name: &lt;input type=\"text\" name=room_id value=\"room1\"&gt;&lt;br&gt;     Player amount: &lt;input type=\"number\" name=player_amount value=4&gt;&lt;br&gt;     &lt;input type=\"submit\" value=\"\u63d0\u4ea4\"&gt;     &lt;\/form&gt; <\/code><\/pre>\n<p>\u7b2c\u4e09\u4e2a player_amount \u90a3\u91cc\u6211\u5e94\u8be5\u662f\u8bbe\u7f6e\u4e86\u6570\u5b57\u7684<\/p>\n<p>\u670d\u52a1\u5668\u7528 nodejs \u63a5\u6536\u8fd9\u4e2a post \u8bf7\u6c42\u7528\u7684 bodyParser<\/p>\n<pre><code>app.post('\/gamepage',function(req,res){      console.log('gamepage request');     console.log(typeof(req.body.player_amount));}); <\/code><\/pre>\n<p>\u7136\u540e console.log \u4e86\u4e00\u4e0b\u7ed3\u679c\u662f\u8fd9\u6837\u7684\uff1a string { player_id: &#8216;player1&#8217;, room_id: &#8216;room1&#8217;, player_amount: &#8216;4&#8217; }<\/p>\n<p>\u6240\u4ee5\u95ee\u9898\u53d1\u751f\u5728\u6211\u7684\u8868\u5355\u63d0\u4ea4\u7684\u65f6\u5019\u6ca1\u6709\u8bbe\u7f6e\u5bf9\u683c\u5f0f\u8fd8\u662f\u6211\u7528\u9519\u4e86\u4e2d\u95f4\u4ef6\u5462\uff1f\u521d\u5b66\u670d\u52a1\u5668\u540e\u53f0\u8fd9\u4e9b\uff0c\u5bf9\u6570\u636e\u7684\u683c\u5f0f\u4e5f\u4e0d\u662f\u5f88\u719f\u6089\uff0c\u6298\u817e\u4e86\u597d\u4e45\u3002 \u5c0f\u5f1f\u5148\u611f\u8c22\u5404\u4f4d\u8001\u54e5\u4e86\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1670526\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : meso5533 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u770b\u4e00\u4e0b\u5f00\u53d1\u8005\u5de5\u5177\u91cc\u9762\u7684\u7f51\u7edc\u8bf7\u6c42\uff0c\u770b\u4e00\u4e0b\u8fd9\u4e2a POST \u8bf7\u6c42\u7684 body \u957f\u4ec0\u4e48\u6837\uff0c\u4f60\u5c31\u77e5\u9053\u4e0a\u4f20\u7684\u8bf7\u53c2\u6570\u6839\u672c\u6ca1\u533a\u5206 string \u8fd8\u662f number                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1670527\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wangxiaoaer <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             HTTP \u534f\u8bae\u4f20\u6570\u636e\u7684\u65f6\u5019\u53ef\u4e0d\u7ba1\u4f60\u4ec0\u4e48\u683c\u5f0f\u7684\uff0c\u4f60\u9700\u8981\u540e\u53f0\u81ea\u5df1\u89e3\u6790\uff0c\u5f53\u7136\u6709\u4e9b\u901a\u7528\u7684\u6bd4\u5982\u6587\u4ef6\uff0cjson \u7b49\u7c7b\u578b\u4f60\u91c7\u7528\u7684 web \u6846\u67b6(servlet node \u7b49)\u53ef\u80fd\u4f1a\u5e2e\u4f60\u89e3\u6790\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1670528\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : baiyi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             post \u7684\u6570\u636e\u5728 body \u91cc\uff0c\u901a\u8fc7 HTTP \u534f\u8bae\u7684 Content-Type \u6307\u5b9a\u7f16\u7801\u683c\u5f0f\uff0c\u5982\u679c\u4f60\u4e0d\u8bbe\u7f6e form \u7684 enctype \u5c5e\u6027\uff0c\u9ed8\u8ba4\u662f application\/x-www-form-urlencoded \u7f16\u7801\u3002\u5982\u679c\u4f60\u60f3\u8981\u7cbe\u786e\u7c7b\u578b\u7684\u7f16\u7801\uff0c\u4e00\u79cd\u5e38\u89c1\u7684\u9009\u62e9\u662f\u4f7f\u7528 application\/json \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1670529\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Waihinchan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @meso5533 \u6211\u4e4b\u524d\u76f4\u63a5\u7528 xmlhttprequest \u770b\u8fc7\u662f\u6b63\u5e38\u7684 \u4f46\u662f\u6211\u540e\u6765\u7528\u8868\u5355\u6765\u53d1\u9001\u8bf7\u6c42\u5c31\u53d8\u4e86 \u4f46\u662f\u770b\u8fd9\u7ed3\u8bba\u5e94\u8be5\u662f\u6211\u89e3\u6790\u8fc7\u7a0b\u51fa\u73b0\u4e86\u95ee\u9898 \u6211\u518d\u53bb\u8bd5\u8bd5 \u8c22\u8c22\u5566                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1670530\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Waihinchan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @baiyi \u6211\u6653\u5f97\uff5e\u73b0\u5728\u7684\u60c5\u51b5\u662f\u6211\u540e\u53f0\u7684\u786e\u80fd\u89e3\u6790\u6210\u6211\u60f3\u8981\u7684 \u4f46\u662f\u5176\u4e2d\u4e00\u4e2a\u5b57\u6bb5\u5c31\u53d8\u6210\u4e86\u4e00\u4e2a\u5b57\u7b26 \u6309\u9053\u7406\u5e94\u8be5\u662f\u6570\u5b57\u6765\u7684 \u6211\u4e4b\u524d\u8bd5\u8fc7\u76f4\u63a5\u53d1\u9001\u4e00\u4e2a\u5bf9\u8c61\u89e3\u6790\u662f OK \u7684 \u6240\u4ee5\u8fd8\u662f\u7591\u60d1\u662f\u4e0d\u662f\u6211\u7684\u8868\u5355\u51fa\u4e86\u95ee\u9898                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1670531\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zachlhb <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8868\u5355\u63d0\u4ea4\u7684\u6240\u6709\u6570\u636e\u90fd\u662f string\uff0cinput \u4e0a\u7684 type \u4e3a number \u53ea\u662f\u7528\u6765\u9650\u5236\u8f93\u5165\u6846\u7684\u8f93\u5165\u7c7b\u578b\uff0c\u5e76\u4e0d\u4ee3\u8868\u63d0\u4ea4\u5230\u540e\u53f0\u5c31\u662f int \u7c7b\u578b\uff0c\u4f60\u8981 int \u7c7b\u578b\u540e\u53f0\u63a5\u6536\u5230\u8981\u81ea\u5df1\u8f6c\u6362\u4e00\u4e0b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1670532\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Waihinchan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @zachlhb \u597d\u7684\uff01\u660e\u767d\u4e86\uff01\u90a3\u6211\u53bb\u505a\u4e2a\u7c7b\u578b\u8f6c\u6362\u597d\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1670533\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Waihinchan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             emmm \u6240\u4ee5\u73b0\u5728\u8865\u5145\u8bf4\u660e\u60c5\u51b5\u662f \u6211\u80fd\u89e3\u6790\u6210 json \u4f46\u662f\u6709\u4e00\u4e2a\u6570\u5b57\u7684\u5b57\u6bb5\u53d8\u6210\u4e86 string \u6839\u636e 6 \u7684\u8001\u54e5\u8bf4\u7684\u662f\u8868\u5355\u53d1\u9001\u90fd\u662f string \u6240\u4ee5\u6211\u5f97\u624b\u52a8\u8f6c\u6362 <br \/>\u6216\u8005\u8bf4\u6709\u6ca1\u6709\u522b\u7684\u65b9\u6cd5\u5462\u2026\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1670534\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : crella <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6d4f\u89c8\u5668\u4ee5 json \u5f62\u5f0f\u4e0a\u4f20\uff0c\u670d\u52a1\u5668\u4ee5 json \u5f62\u5f0f\u89e3\u6790\u3002<br \/>\u53ef\u4ee5\u770b\u770b json \u7684\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316\u662f\u600e\u4e48\u505a\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u4ec0\u4e48\u6211\u7684\u8868\u5355 post \u4e86\u4e00\u4e2a\u6570&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/101025"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=101025"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/101025\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=101025"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=101025"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=101025"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}