About getting the root directory
I think $_server[' document_root ' can
How did someone use this method?
Define (' _music_root_ ', str_replace (' \ \ ', '/', substr (DirName (__file__), 0,-3)));
------Solution--------------------
$_server[' document_root ') needs to be defined in the server configuration file, and the second method is not determined if there is a configuration permission.
------Solution--------------------
Yes, in most cases $_server[' document_root ' will do.
However, you should note that $_server[' document_root ' in some server configurations is not a value, or incorrect
Also $_server[' document_root ' does not correctly reflect the root of the project when your project is placed in a subdirectory
So it can be understood that:
$_server[' Document_root ' is the root path of the web site
Define (' _music_root_ ', str_replace (' \ \ ', '/', substr (DirName (__file__), 0,-3)));
is the root path of the project
------Solution--------------------
Key in the last-3 you can try not to lose, or-5
You just output the address and you'll see.
This is put in your configuration file in a code, get the absolute path of the file, minus a few is to remove the tail folder name, if you do not put in the root, the root, the other place calls are right
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