Home > Backend Development > PHP Tutorial > How to edit the host file quickly and easily_PHP tutorial

How to edit the host file quickly and easily_PHP tutorial

WBOY
Release: 2016-07-13 10:30:58
Original
1067 people have browsed it

When developing web programs, we sometimes do this, which is to modify the hosts file to do virtual domain name mapping to facilitate local development. For example, point the domain name www.phpernote.com to the local 127.0.0.1. This operation process itself is not complicated at all, but in the Windows environment, the hosts file is hidden very deep, so every time we have to Baidu the hosts file path and then open the file directory layer by layer to find the file. If you change it frequently, it will be really troublesome, so here I have summarized a relatively good and slightly masterful method to share.

(1) Use text editing software such as Notepad to write the following code:

::去除hosts文件只读属性
attrib -R C:\windows\system32\drivers\etc\hosts
::用notepad编辑hosts文件
notepad C:\windows\system32\drivers\etc\hosts
::给hosts文件加上只读属性
attrib +R C:\windows\system32\drivers\etc\hosts
Copy after login

Then save the file as a .bat file with a suffix name (for example: hosts.bat).

(2) Place the file into the WINDOWSsystem32 directory. In fact, it does not have to be placed in this directory. You can create a new directory anywhere and copy the full path of the directory. Just go to the environment variables of the Windows system.

OK, two simple steps. If you need to modify the hosts file in the future, just enter hosts directly during operation. After pressing Enter, the system will automatically make the hosts file writable, then open the hosts file and wait for the editing to be completed. When exiting, the file will automatically become read-only.

Articles you may be interested in

  • Use PHP's GZip compression function to compress website JS and CSS files to speed up website access
  • bat batch Processing and modifying the host file
  • Javascript implementation of string interception function summary (including the introduction of using Js to intercept Chinese characters)
  • jquery to determine whether the page has loaded the jquery file
  • Use Google It will be better to load the jquery library file
  • PHP uses Curl Functions to realize multi-threaded web crawling and downloading files
  • PHP is the safest and most realistic solution to determine the uploaded file type
  • Location of hosts file and how to open hosts file

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/764185.htmlTechArticleWhen developing web programs, we sometimes do such an operation, which is to modify the hosts file to do virtual domain name mapping. Convenient for local development, for example, point the domain name www.phpernote.com to the local...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template