我是这样提交表单的
$http({
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
method: 'POST',
url: url,
data: {
type: 1
}
})
为什么我的服务器接到的会是这样的东西?
{ '{"type":1}': '' }
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
服务端不能直接用 $_REQUEST/$_POST获取到,而需要用:
$params = json_decode(file_get_contents('php://input'),true);
来获取提交数据