Re: guess documentroot
| From: | Ivo F.A.C. Fokkema | Date: | Mon, 09 Oct 2006 07:30:10 +0000 |
| Subject: | Re: guess documentroot | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-242832@lists.php.net to get a copy of this message | ||
On Thu, 05 Oct 2006 16:35:04 +0200, Javier Ruiz wrote:
> Perfect!
>
> got it using the following:
>
> /* 1 - remove the query string just in case it contains a '/' in it
> 2 - like Clive said, substr() and strrpos() 'clean' the path to provide
> the directories only */
>
> $aPath = str_replace($_REQUEST['QUERY_STRING'], '',
> $_SERVER['SCRIPT_NAME']);
> $aPath = substr($aRuta, 0, (strrpos($aRuta, '/') + 1));
>
> Thanks a lot guys :)
Why make your life harder than it needs to be:
$sPath = dirname($_SERVER['PHP_SELF']);
Ivo