note 21138 modified in function.dirname by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 19:17:46 +0000 |
| Subject: | note 21138 modified in function.dirname by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142287@lists.php.net to get a copy of this message | ||
To get the directory of current included file:
<?php
dirname(__FILE__);
?>
For example, if a script called 'database.init.php' which is included from anywhere on the
filesystem wants to include the script 'database.class.php', which lays in the same
directory, you can use:
<?php
include_once(dirname(__FILE__) . '/database.class.php');
?>
--was--
To get the directory of current included file:
dirname(__FILE__);
For example, if a script called 'database.init.php' which is included from anywhere on the
filesystem wants to include the script 'database.class.php', which lays in the same
directory, you can use:
include_once(dirname(__FILE__) . '/database.class.php');
http://php.net/manual/en/function.dirname.php