0
点赞
收藏
分享

微信扫一扫

php环境部署:phpstudy设置本地测试域名找不到hosts文件的解决方案

一天清晨 2022-01-31 阅读 69


php环境部署:phpstudy设置本地测试域名找不到hosts文件的解决方案_解决方案

在win10上配置phpstudy本地域名,发现找不到hosts文件。

hosts文件的位置:C:\WINDOWS\system32\drivers\etc

解决方案如下:


  1. Windows 徽标键 图片+X键,调出cmd命令行工具;
    php环境部署:phpstudy设置本地测试域名找不到hosts文件的解决方案_解决方案_02
  2. 输入一下代码:

for /f %P in ('dir %windir%\WinSxS\hosts /b /s') do copy %P %windir%\System32\drivers\etc & echo %P & Notepad %P
  1. 正常创建并显示:
    php环境部署:phpstudy设置本地测试域名找不到hosts文件的解决方案_php_03
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

lockdatav Done!



举报

相关推荐

0 条评论