Maison  >  Article  >  développement back-end  >  php-PHP怎么获取获取angularjs http.post

php-PHP怎么获取获取angularjs http.post

WBOY
WBOYoriginal
2016-06-02 11:28:23867parcourir

http.postphppostangularjs

前端:$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'); 没显示任何数据
图片说明
这是什么原因,没获取到数据吗?

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn