很多前端做手机页面都有类似的困扰,就是测试起来特别麻烦
开始的时候都是数据线连接手机到电脑,安装个手机助手,然后把项目考到手机本地存储里,再从手机打开查看,虽然有点麻烦,但还在android机上还能用,iphone机就不行了,不知道把文件放哪里。。这就很蛋疼。。
下面用另一种方式来解决这个问题,那就是访问本机ip来查看文件
访问本机IP查看本机项目文件
1、搭建个本地服务器 可以下载 wamp5 wampserver phpstudy等都可以,安装完成后运行,这里以wampserver为例
2、window+r 打开运行窗口,输入cmd进入 dos控制面板 输入ipchonfig 查看本机ip
3、打开apache的配置文件 httpd.conf
搜索 </Directory>
找到的两处,第一处改成:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
第二处改成:
<Directory "e:/wamp/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order Deny,Allow
Allow from all
Allow from all
</Directory>
上面配置改好后,重启服务
4、关闭window防火墙
然后关闭防火墙服务
完了以后,就可以访问ip就可以访问了。。
在手机上访问192.168.1.104这个ip 需要你公司的或你家里的wifi连接,确定你本机的ip在这个wifi这个ip段。。
如果你用360浏览器打开的话,那个在网址后面有个二维码,扫二维码也可以访问。。。
欢迎关注技术开发分享录:http://fenxianglu.cn/