Good morning. For more information about the absolute path of php, see The php Tutorial.

Source: Internet
Author: User
Good morning. may I ask friends about the absolute path of php? The New Day is so cool. The younger brother has a question. Define (HOST,. $ _ SERVER [HTTP_HOST].); I want to use absolute paths both locally and on the SERVER, so I defined the above one. There is no problem on the server. But in the local environment, for example, my website is localhostcsdn, but the local echo & nbsp good morning, may you ask about the php absolute path?
Dear friends, the new day is sunny.
The younger brother has a question.
Define ('host', 'http: // '. $ _ SERVER ['http _ host'].'/');
I want to use absolute paths both locally and on the server, so I defined the one above.
There is no problem on the server.
However, locally, for example, http: // localhost/csdn/
But the local echo HOST; only http: // localhost/
How can I write it on the server and locally? That is, http: // localhost/lcsdn/is displayed locally.
------ Solution ----------------------
Put your program in the root directory, not in the lcsdn folder.
That is, your program and lcsdn must belong to the same layer.
------ Solution ----------------------
Set to virtual host
Or rewrite the root of the specified website through url.


In fact, it is not advisable to write a full url.
------ Solution ----------------------
$ _ SERVER ['http _ host'] is used to obtain the domain name or HOST address.
Locally, you can use apache httpd. conf to set the virtual host to solve the problem.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.