document root
| From: | Samuel Luescher | Date: | Thu, 30 Nov 2000 19:24:53 +0000 |
| Subject: | document root | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-28104@lists.php.net to get a copy of this message | ||
does anybody know about a very sophisticated way to get a (relative) path to
the document root of a site?
i get it exploding $PHP_SELF into directories, but i think there must be a
smarter way.
function get_rootpath() {
global $PHP_SELF;
$dirs = explode("/",$PHP_SELF);
$path = "";
for ($i = 1; $i < sizeof($dirs)-1; $i++) {
$path .= "../";
}
return $path;
}