我找不到关于如何访问我自己的本地主机作为开发环境来测试 http 服务的明确答案。 到目前为止我已经尝试做 http://localhost:8080/Folder/this.php它去了 www.localhost.com ???我检查过配置文件中的访问端口为80。
这是我想要实现的代码片段
function TMSSvc($http,$rootScope){
this.loadBlogs= function(){
$http.get("http://localhost:8080/webService/getBlogs.php").success(function(result){
$rootScope.$broadcast("TMSApp.blogs",result);
});
}
}
你能帮我吗?我是这方面的初学者。 谢谢您
最佳答案
如果您使用的是 Windows,则需要转到该文件:
C:\Windows\System32\drivers\etc\hosts
如果您使用的是 Linux 或 Mac:
/etc/hosts (i.e. sudo nano /etc/hosts)
然后取消注释该行:
# 127.0.0.1 localhost
所以它是这样的:
127.0.0.1 localhost
然后您应该能够使用 localhost 访问本地服务器。
关于javascript - 使用http服务时访问xampp本地主机文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33644311/