我正在使用WAMP来建立我的电脑作为服务器。我在数据库中有一些值,现在我希望我的离子应用程序检索数据。在我的app.js中,我使用get请求获取我的php文件从db获取的任何内容:
.controller('customersCtrl', function($scope, $http) {
$http.get("http://localhost//TempSensorTest/query.php")
.success(function (response) {$scope.names = response.records;});
当我在浏览器中打开这个url时,我得到一个带有值的json对象。
但是,当我在Android手机上运行应用程序时,控制台会打印:
Failed to load resource: net::ERR_CONNECTION_REFUSED http://localhost//TempSensorTest/query.php
请注意,大约3个月前,我对不同的应用程序使用了相同的方法,但确实有效。但是我不知道现在可能会出现什么情况呢?
答案 0 :(得分:2)
在第二行,你有" http:http://localhost//TempSensorTest/query.php" 尝试删除第一个" http:"。