PHP默认识别的数据类型是application/x-www.form-urlencoded标准的数据类型
解决方法1(前端转成FormData格式)
// 转成后端接收的格式
formartData(source){
const data = new FormData();
if(source){
Object.keys(source).forEach(key=>{
data.append(key,source[key])
})
}
return data
},
解决方法2:后端用 $GLOBALS[‘HTTP_RAW_POST_DATA’] 或 file_get_contents(‘php://input’) 接收参数