前端:$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'); 没显示任何数据
这是什么原因,没获取到数据吗?
PHP怎么获取获取angularjs http.post
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答
- pdffj 2016-02-28 06:10关注
$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一下需要那个字段就显示那个字段好了。解决 无用评论 打赏 举报
悬赏问题
- ¥15 chaquopy python 安卓
- ¥50 Kubernetes&Fission&Eleasticsearch
- ¥15 有没有帮写代码做实验仿真的
- ¥15 報錯:Person is not mapped,如何解決?
- ¥30 vmware exsi重置后登不上
- ¥15 易盾点选的cb参数怎么解啊
- ¥15 MATLAB运行显示错误,如何解决?
- ¥15 c++头文件不能识别CDialog
- ¥15 Excel发现不可读取的内容
- ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题