这里我通过 $http.post 将数据发送到 data/user.php
app.factory('loginService',function($http){
return{
login:function(data,scope){
var $promise=$http.post('data/user.php',data); //send data to user.php
$promise.then(function(msg){
if(msg.data=='succes') scope.msgtxt='Correct information';
else scope.msgtxt='incorrect information';
});
}
}
});
数据/user.php 代码
<?php
$user=json_decode(file_get_contents('php://input')); //get user from
if($user->mail=='elgaliamine@gmail.com' && $user->pass=='1234')
print 'succes';
else
print 'error';
?>
http://localhost:8000/app/data/user.php 404 (Not Found)
并且浏览器在我尝试时不断显示 mePOSThttp://localhost:8000/app/data
然后它显示存在user.php
为什么它给出404错误?请帮帮我...