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.