我使用xip。io用于此。
xip。io是一个神奇的域名,它为任何IP地址提供通配符DNS。假设您的LAN IP地址为10.0.0.1。使用XIP。io,
10.0.0.1.xip.io resolves to 10.0.0.1
www.10.0.0.1.xip.io resolves to 10.0.0.1
mysite.10.0.0.1.xip.io resolves to 10.0.0.1
foo.bar.10.0.0.1.xip.io resolves to 10.0.0.1
使用
static IP address for DHCP:

在MAMP PRO中,select the host1
要使用的(wp99.dev
在本例中),并在“高级”选项卡中,将以下内容用作常规设置的服务器别名:
1
链接文章中的Apache说明

在MAMP中应用更改并重新启动服务器之前,请更改站点的设置:

在WordPress中保存更改,在MAMP中重新启动服务器,登录站点
在本地网络的任何设备/计算机上进行测试。
与其更改网站设置,不如使用一种有趣的技术wp-config.php
:
require_once(\'/path/to/Browser-Detection/b5f-browsers.php\');
if( b5f_browser_check( \'mobile\' ) )
{
define( \'WP_HOME\', "http://wp99.{$_SERVER[\'SERVER_ADDR\']}.xip.io");
define( \'WP_SITEURL\',"http://wp99.{$_SERVER[\'SERVER_ADDR\']}.xip.io");
}
这样,桌面版就保留了不错的地址,在手机中查看时,就可以使用xip。io地址已送达。
Here\'s a Gist 对于文件b5f-browsers.php
, 其中使用Chris Schuld\'s Browser.php 班
相关: