【发布时间】:2017-02-12 06:36:45
【问题描述】:
我是ionic1 framework 的新手,正在sidemenu ionic app 工作。我想从Mysql Database获取播放列表。
我在我的 controller.js 中尝试过这个:
.controller('PlaylistsCtrl', function($scope,$http) {
$http.get("#/php/list.php")
.success(function (response) {
$scope.playlists = response.records;
});
console.log($scope.playlists);
})
php文件代码:
header("Content-Type: application/json; charset=UTF-8");
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
$json[] =array('title'=>'Reggae','id'=>1);
$json[] =array('title'=>'test','id'=>2);
echo json_encode($json);
它给出了未定义的。
请帮助我哪里出错了。
【问题讨论】:
标签: php html mysql angularjs ionic-framework