PHP怎么获取获取angularjs http.post

前端:$http({
method: 'POST',
url: "http://127.0.0.1:8080/school/studentadd.php",
data : newnames,
headers : {'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(){
console.log('success');
}).error(function(){
alert("error");
});
PHP接收:echo file_get_contents('php://input'); 没显示任何数据
图片说明
这是什么原因,没获取到数据吗?

$http.post获得的返回不是个json么?取callback的success方法返回值就可以啊。
$http({
method : 'POST',
url : 地址,
data: 数据
}).success(function(data, status, headers, config) {
console.log(data);
}).error(function(data, status, headers, config) {

});
把data赋给你的变量,log一下需要那个字段就显示那个字段好了。

http://www.cr175.com/info/4067.html