finding the web root

From: Date: Tue, 08 Jun 2010 18:27:43 +0000
Subject: finding the web root
Groups: php.general 
Request: Send a blank email to php-general+get-305978@lists.php.net to get a copy of this message
Hi, i like to find the web root where the current file is. is there a better solution? it must work both on linux and windows machines... <?php $root = explode('/', $_SERVER['DOCUMENT_ROOT']); $cwd = explode(DIRECTORY_SEPARATOR, __DIR__); $web_root = '/' . implode('/', array_diff($cwd, $root)); echo $web_root; ?> maybe there is a function for that :D:D:D Br Tanel

« previous php.general (#305978) next »