我有一个postman (在Chrome中没有打开的postman ),我正在try 使用原始JSON进行POST请求.
在Body选项卡中,我 Select 了"raw"和"JSON(application/json)",主体如下:
{
"foo": "bar"
}
头球我有1Content-Type: application/json
在PHP方面,我现在只做了print_r($_POST);
个,得到了一个空array.
如果我使用jQuery并执行以下操作:
$.ajax({
"type": "POST",
"url": "/rest/index.php",
"data": {
"foo": "bar"
}
}).done(function (d) {
console.log(d);
});
我得到了预期的结果:
Array
(
[foo] => bar
)
那为什么postman 不在呢?
postman 截图:
和标题: