note 72471 added to function.include
| From: | NathanOstgard at osu1 dot php dot net | Date: | Fri, 19 Jan 2007 22:32:23 +0000 |
| Subject: | note 72471 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-121937@lists.php.net to get a copy of this message | ||
You can also use debug_backtrace to write a function that do the chdir automatically:
<?php
function include_relative($file)
{
$bt = debug_backtrace();
$old = getcwd();
chdir(dirname($bt[0]['file']));
include($file);
chdir($old);
}
?>
----
Server IP: 216.194.113.175
Probable Submitter: 24.234.89.120
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit -- https://master.php.net/note/edit/72471
Del: integrated -- https://master.php.net/note/delete/72471/integrated
Del: useless -- https://master.php.net/note/delete/72471/useless
Del: bad code -- https://master.php.net/note/delete/72471/bad+code
Del: spam -- https://master.php.net/note/delete/72471/spam
Del: non-english -- https://master.php.net/note/delete/72471/non-english
Del: in docs -- https://master.php.net/note/delete/72471/in+docs
Del: other reasons-- https://master.php.net/note/delete/72471
Reject -- https://master.php.net/note/reject/72471
Search -- https://master.php.net/manage/user-notes.php