我有以下 js 片段:
fetch('/some/webhook', {
method: 'post',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({test:'1'})
}).then(function(res) {
// do something here
}).then(function(data) {
// do something else here
});
几个小时以来,我一直试图将正文发送到我的服务器,但监听脚本在 $_POST 变量中看不到任何内容。Webhook 接收请求。一个简单的:
die (var_dump($_POST));
结果控制台中显示一个空数组,我本希望在其中看到test值为 1 的变量。
怎么了?
慕妹3242003