[英]phonegap doesn't connect with xampp server on localhost
I have a PhoneGap project on my windows 7 PC. 我的Windows 7 PC上有一个PhoneGap项目。 I have installed the PhoneGap developer app on my PC which connects through server address: http://192.168.1.16:3000 .
我已经在PC上安装了PhoneGap开发人员应用程序,该应用程序通过服务器地址http://192.168.1.16:3000连接。
When I load the project on the PhoneGap developer app, everything works fine. 当我在PhoneGap开发人员应用程序上加载项目时,一切正常。 The problem is that I have a database which is saved locally on my PC (localhost) and I access it through XAMPP.
问题是我有一个数据库,该数据库保存在本地PC(本地主机)上,并且可以通过XAMPP访问它。 When I setup the XAMPP server I can not access the database and when I run the project it's showing me an error.
设置XAMPP服务器时,我无法访问数据库,并且在运行项目时,它向我显示错误。
If I connect an online database on a server it works. 如果我在服务器上连接了在线数据库,它将正常工作。 I mean it's working with an online database but not working on localhost.
我的意思是它正在使用在线数据库,但不能在本地主机上使用。
Can anyone help me how to access my database on localhost server. 任何人都可以帮助我如何访问本地服务器上的数据库。
var url = "http://localhost:81/myapp/auth.php";
And if i run open this link on above image result here: 如果我运行,请在上面的图片结果上打开此链接:
Your app is running on the Phone and interprets localhost
as its own host. 您的应用程序正在手机上运行,并将
localhost
解释为其自己的主机。
Try to use the IP you get from your Router of your PC smth. 尝试使用从PC smth的路由器获得的IP。 like
192.168.xx
or so. 如
192.168.xx
左右。
Also be aware that direct connections to your PC-Database may be blocked because of the listen
config of your MySQL Server 另请注意,由于MySQL服务器的
listen
配置,可能会阻止与PC数据库的直接连接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.