【发布时间】:2014-09-21 22:19:59
【问题描述】:
正如我在标题中所写,我无法从 PHP 获得任何正确答案。有人知道吗?
Javascript
var app = angular.module("appMovies", []);
app.controller("listMovies", ["$scope", "$http", function($scope, $http){
getMovies($http);
}]);
function getMovies(_http){
_http.get("movies.php", {data:{"getList":"LISTA"}})
.success(function(data, status, header, config){
console.log( data );
})
.error(function(data, status, header, config){
//console.log(data, status, header, config);
});
}
PHP
var_dump( file_get_contents("php://input") );
所以,我明白了……对不起,我的错。显然 $_GET 只从 URL 获取数据,所以我应该写
$http.get("movie.php/?getList=LISTA")...
【问题讨论】:
-
为什么要使用
file_get_contents进行 GET 请求? -
是的,我在这里看到了其他例子
标签: ajax angularjs get file-get-contents