How to go to the "root" directory of a website?
There is a PHP website into a Linux computer webserver. In a particular PHP file , which is located in a deep subdirectory o开发者_开发百科f this site , I want to go to the first directory of the site. How to write the PHP code to achieve that ?
$_SERVER['DOCUMENT_ROOT']
will respond the filesystem path to http://your_hostname/
Use $_SERVER['DOCUMENT_ROOT']
Documenation
$_SERVER['DOCUMENT_ROOT']
this will give the root directory.
精彩评论