如何从同一网络上的iPhone访问Mac localhost PHP服务器上的网站?
我的Mac的IP是192.168.1.122,服务器在端口8000上。我试着用我的iPhone连接到它如何从同一网络上的iPhone访问Mac localhost PHP服务器上的网站?,php,server,localhost,Php,Server,Localhost,我的Mac的IP是192.168.1.122,服务器在端口8000上。我试着用我的iPhone连接到它 http://192.168.1.122:8000/index.php http://<name>.local:8000/index.php both of the above without the "http://" http://192.168.1.122:8000/index.php http://.local:8000/index.php 以上两项都不带“http://
http://192.168.1.122:8000/index.php
http://<name>.local:8000/index.php
both of the above without the "http://"
http://192.168.1.122:8000/index.php
http://.local:8000/index.php
以上两项都不带“http://”
请注意
http://<name>.local
http://.local
工作,显示一个页面,上面写着“它工作!”
如何在iPhone上查看站点文件
编辑:按预期在Mac上工作根据一个类似但不同的问题得出结论: 使用以下命令打开PHP服务器
$ php -S 0.0.0.0:8000
然后,通过输入主机的IP:8000,而不是0.0.0:8000,您可以从连接到同一网络的任何设备上的任何浏览器访问它