note 9922 added to require
| From: | kangaroop at email dot com | Date: | Fri, 01 Dec 2000 16:22:11 +0000 |
| Subject: | note 9922 added to require | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8327@lists.php.net to get a copy of this message | ||
when using require() in file that is already require()ed from different directory, it's
important to remember that require() just replaces itself with contents of specified file, therefore
any path in the specified file is relative to path of original file, NOT the require()ed one!
and the same applies to any subsequently require()ed file, of course.
little example - let's have directory with two files in it, "master.php" and
"define.php", and its subdirectory "scripts" with "include.php" file.
then, if master.php requires include.php, and include.php requires define.php, the line in
include.php should look like this:
require("define.php");
and not
require("../define.php");
http://www.php.net/manual/function.require.php