finding the web root

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux