Connecting to localhost/index.php through my smart

2019-05-29 19:34发布

I want to connect to my localhost using my smart phone through WiFi.

I got my IP via www.whatismyip.com, and got my smart phone to connect to my laptop successfully.

However, when I type localhost as the web address in the browser of my phone, nothing shows up.

How can I access localhost/index.php page through my smart phone?

4条回答
再贱就再见
2楼-- · 2019-05-29 19:47

Are you sure that your pc and phone in the same lan?

Your phone can access first, because you use public network ip. I guess you can not access by using localhost ip, because they are not in the same lan.

查看更多
Juvenile、少年°
3楼-- · 2019-05-29 19:59

The easiest would be to upload your source to a server that accessible through the internet and get the hosts ip address and try to load it on the smart phone.

If you want to access your app from your laptop you need to figure out what is your ip on your laptop then access your localhost.

 On windows run: ipconfig /all (get ip)

 On linux run: sudo / ip -addr (get ip) 

Make sure you stay connected to the wifi on your smartphone.

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-05-29 20:08

1) Install a proxy server on your laptop (for example FreeProxy) don't run it yet!

2) Get the local ip of your laptop (the one used inside your network, given by your wifi router) by running Start -> cmd -> ipconfig.

Look for a line like: Wireless LAN adapter Wireless Network Connection And under it you need the value from IPv4 Address. The IP should be something like: 10.x.x.x or 192.168.x.x Copy this IP address, you will need it for the next step.

2) Edit the hosts file on your laptop (c:\windows\system32\drivers\etc\hosts), you will need administrator permissions to edit this file. add a line into this file like:

10.0.0.1 laptop

Now, the 10.0.0.1 should be replaced by the local IP of your laptop (obtained at step #2). Save the file.

3) Run the proxy server.

4) Configure your smarphone to use the proxy server (this is smartphone specific, which one do you have?).

5) In your smartphone browser type the address: http://laptop/index.php

查看更多
仙女界的扛把子
5楼-- · 2019-05-29 20:12

use your laptop wifi connection ip instead of localhost like 192.168.50.2.

查看更多
登录 后发表回答