In the use of some of the following PHP integrated development tools (such as Phpstudy wampserver, etc.)
Sometimes there is a need: I don't want to visit my localhost/xxx/xxx/xxx.php in such a way
What about the file? It's too much trouble to write!
How to solve such a problem?
Very simple, take phpstudy as an example (Wampserver similar)
Let's start with a new test file in the WWW directory (for convenience, write a phpinfo bar):
Normal we want to access this file is this:
The writing is still quite a lot.
What do you want to do with domain access? For example: through Test.info
Other Options menu, site domain name management
Fill in the website domain name (ex: Test.info)
Select the Site directory (point to the test folder that we just created in the WWW directory)
Then select the "New" button
Finally save the settings and build the configuration file
Is it possible to use this domain name for access now?
Let's try it!
It doesn't look good! Why is it? Because the local Hosts file (the local DNS resolution table, the server is also some, generally we visit the domain name will go to the DNS server to find the corresponding IP will be able to access the site we want to go! ) has not been modified. Let's modify this file:
The path under win:
Open the Hosts file as an administrator (not sure to make a backup first)
Add a corresponding relationship on the last line
127.0.0.1 Test.info
Save it, let's try it again! Did you open it normally?
Later we create a new PHP file access format under the Test folder is: test.info/xxx.php
The advantage is that some of the interfaces that restrict IP are not allowed to be accessed. Of course, also to try and
The formal environment remains consistent. It's a good habit. Let's form together!
(Avatar from micro-blog-Self-study illustration half a year) next goodbye!
Windows modifies the local Hosts file