如何通过 wifi wampserver 访问 android 上的本地主机?

How to access localhost on android over wifi wampserver?

使用 Wampserver 和 Windows,我想通过 wifi 访问 android 上的本地主机。

我电脑的ip是192.168.0.20。 Sam wifi 网络。

我在 C:\wamp64\bin\apache\apache2.4.39\conf\extra\http-vhosts.conf 上添加了 Require ip 192.168.0 (如果我添加了 Require all granted' 也会出现同样的问题) :

<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
    Require ip 192.168.0
  </Directory>
</VirtualHost>

但是当我尝试从我的 phone android(相同的 Wifi 网络)访问它时,出现此错误:

This site can't be reached

192.168.0.20 took too long to respond.

Try:

Checking the connection

ERR_CONNECTION_TIMED_OUT

你能帮帮我吗?

你需要将 localhost 映射到你的计算机 ip 地址,你需要从 ipconfig cmd 命令获取 ip 地址,你需要检查你的防火墙