Re: climb up the path

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

 




i need a way to get the path to the parent folder of the folder i am in. one "dirty" way i found is this -

require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR .
             ".."              . DIRECTORY_SEPARATOR .
             "config.php");

i can also explode() and reassemble all folders except the last, but this looks also dirty...

is there a direct way?

There's nothing dirty about dirname(), and for your issue, just call it twice:

dirname(dirname(__FILE__));

--
Richard Heyes

        Employ me:
http://www.phpguru.org/cv

+----------------------------------------+
| Access SSH with a Windows mapped drive |
|    http://www.phpguru.org/sftpdrive    |
+----------------------------------------+

--
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