多看文档
$_POST
仅限于:
当 HTTP POST 请求的 Content-Type 是 application/x-www-form-urlencoded 或 multipart/form-data 时,会将变量以关联数组形式传入当前脚本。
http://php.net/manual/zh/rese...
如果你想要接收 Content-Type
为 application/json
的值, 需要判断 Header
手动解析
解析方式大概就是: 通过 php://input
获得body, 然后 json_decode
转为数组
http://php.net/manual/en/wrap...