note 104432 deleted from function.include by googleguy
| From: | googleguy@php.net | Date: | Wed, 01 Aug 2012 06:51:55 +0000 |
| Subject: | note 104432 deleted from function.include by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189547@lists.php.net to get a copy of this message | ||
Note Submitter: bimal at sanjaal dot com
----
When two different files located in separate directories try to INCLUDE/REQUIRE the relative file
names, this may help you correctly FIND the included files.
The code is a snapshot only. Your environment might change.
<?php
$now_at_dir = getcwd();
chdir(realpath(dirname(__FILE__).'/../../../somewhere/'));
# Out of the general area
require_once('a_differnet_path/browse_wine.php');
chdir($now_at_dir);
?>
The basic trick is in saving the current directory, changing to the required directory, including
the file, and then return back to the original directory.