AngularJs $ http.post()在PHP中作为键接收

时间:2016-01-04 08:52:58

标签: javascript php angularjs

我正在使用AngularJS发送$http.post请求 这是我的AngularJS代码:

var app = angular.module('myApp', [],function($httpProvider)
{
    $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';

});
app.controller('notificationsCtrl', function($scope, $http) {
    $http.get("listAllNotifications.php")
        .then(function (response) {$scope.notifications = response.data.records;});
    $scope.removeRow = function (row)
    {
        var parameter = JSON.stringify({'actions': row});
        $res = $http.post("../api/notifications.php",parameter)
            .then(function (response) {$scope.notifications = response.data.records;});
    }
});

这是接收它的PHP服务器端代码:

<?php
print_r($_POST,TRUE);

这是打印结果:

  

{&#34;动作&#34;:1450591689} =&#34;&#34;

key=>value

中将$_POST作为ComponentRef,我做错了什么?

感谢

0 个答案:

没有答案