Php 带有post参数的ajax调用-无法在服务器端接收该参数
我在下面添加了对ajax调用的调用Php 带有post参数的ajax调用-无法在服务器端接收该参数,php,angularjs,Php,Angularjs,我在下面添加了对ajax调用的调用 $http({ url: "http://localhost/angular-js-apis/listing.php", method: "POST", data: {type: "list"}, headers: {'Content-Type': 'application/json;charset=utf-8'} }).then(function mySuccess(response)
$http({
url: "http://localhost/angular-js-apis/listing.php",
method: "POST",
data: {type: "list"},
headers: {'Content-Type': 'application/json;charset=utf-8'}
}).then(function mySuccess(response) {
$scope.listing = response.data;
}, function myError(response) {
$scope.myWelcome = response.statusText;
});
和服务器站点上的以下文件代码
但在我的服务器中,它只打印$\u POST
的空值
有人能告诉我这里有什么问题吗?试试下面的片段 棱角分明
$data = json_decode(file_get_contents('php://input'), true);
print_r($data);
服务器
$data = json_decode(file_get_contents('php://input'), true);
print_r($data);
$data = json_decode(file_get_contents('php://input'), true);
print_r($data);