Re: Re: file knowing its own directory
| From: | Jordi Canals | Date: | Wed, 09 Jun 2004 23:53:59 +0000 |
| Subject: | Re: Re: file knowing its own directory | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-188001@lists.php.net to get a copy of this message | ||
Red Wingate wrote:
the magic constant __FILE__ will give you the absolut filesystem location of the file it is called. Eg: /home/www/tests/foo.php -> <?php echo __FILE__ ; ?> will print: '/home/www/tests/foo.php'; to retrieve the path only you could do: /home/www/tests/foo.php -> <?php echo str_replace( basename ( __FILE__ ) , '' , __FILE__ ); ?> I think could be easier with dirname(__FILE__)Regards, Jordi.