How can I find the root directory on the server?
1 answer
echo $_SERVER['DOCUMENT_ROOT'];
The above line will give you the root directory of your site.
You can define the path directly as a constant somewhere in your shared file including the file
define('PATH_TO_PROJECT_ROOT', '/path/to/projectroot/');
and use constant wherever you want
+2
source to share