phpstudy hosts文件可能不存在或被阻止打开

引发该问题的原因在于system32里的hosts文件无故消失。

解决方法

win+r,然后输入cmd打开小黑框,输入以下代码:

for /f %P in ('dir %windir%\WinSxS\hosts /b /s') do copy %P %windir%\System32\drivers\etc & echo %P & Notepad %P

如果输入以上代码后,C:\Windows\System32\drivers\etc文件夹下,仍然没有hosts文件。

那就再来一遍,之后会自动打开一个hosts文件的txt文档,将该文档另存为到桌面,改文件名为hosts(注意,文件格式不能是.txt),人工复制到etc文件夹下就OK。

Windows工具

composer安装

2023-6-7 10:29:12

win10/11Windows

win10/11 进入睡眠太快

2023-6-20 10:27:00

搜索