{"id":161,"date":"2023-02-18T21:27:54","date_gmt":"2023-02-18T13:27:54","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=161"},"modified":"2023-02-18T21:28:34","modified_gmt":"2023-02-18T13:28:34","slug":"php-receive-post-data-compatible","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/18\/php-receive-post-data-compatible\/","title":{"rendered":"PHP\u63a5\u6536POST\u6570\u636e\u517c\u5bb9form-data\u3001x-www-form-urlencoded\u3001application\/json"},"content":{"rendered":"<pre><code class=\"language-php\">$params = array();\nforeach ($_POST as $key =&gt; $value) {\n    $params[$key] = $value;\n}\n\nif (empty($params)) {\n    $params_str = file_get_contents(&quot;php:\/\/input&quot;);\n    $params = json_decode($params_str, true);\n}\n\nksort($params);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>$params = array(); foreach ($_POST as $key =&gt; $value [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69],"tags":[],"class_list":["post-161","post","type-post","status-publish","format-standard","hentry","category-php-basic"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=161"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/161\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}