Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PHP、Ionic和angularjs获取数据_Php_Angularjs_Ionic Framework - Fatal编程技术网

使用PHP、Ionic和angularjs获取数据

使用PHP、Ionic和angularjs获取数据,php,angularjs,ionic-framework,Php,Angularjs,Ionic Framework,我正在努力,我认为这是一件很容易的事情,但我不能让它工作。 我试图在一个用Ionic创建的应用程序中获取一些简单的数据 我是Angularjs的新手,所以可能我做错了:-) 我的控制器代码: .controller('StarterCtrl', function($scope, $http) { $http.get("ajax/getMembers.php").success(function(data){ $scope.tasks = data alert(data); }) })

我正在努力,我认为这是一件很容易的事情,但我不能让它工作。 我试图在一个用Ionic创建的应用程序中获取一些简单的数据

我是Angularjs的新手,所以可能我做错了:-)

我的控制器代码:

.controller('StarterCtrl', function($scope, $http) {
 $http.get("ajax/getMembers.php").success(function(data){

 $scope.tasks = data
 alert(data);
 })
})

还有我的php代码

<?
header('Content-Type: application/json');
$arrayTest = array('test');
echo json_encode($arrayTest);

对不起!!!我犯了一个愚蠢的错误。我认为Ionic可能可以在git bash中运行PHP fil,但当然不能

您有运行PHP的服务器吗?不,不,您需要一个服务器。:)
<?
header('Content-Type: application/json');
$arrayTest = array('test');
echo json_encode($arrayTest);