note 94825 deleted from function.include by danbrown
| From: | danbrown@php.net | Date: | Fri, 27 Nov 2009 13:48:50 +0000 |
| Subject: | note 94825 deleted from function.include by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163336@lists.php.net to get a copy of this message | ||
Note Submitter: Will P.
----
After asking around a bit on IRC, and in some trial and error, I found that when you include a file
(say, /includes/foo.php) in another file (/includes/bar.php), and include that file within another
file from another directory (/stuff/script.php), the includes have to be relative to their parent
includer.
For example, the following is valid (in my experience):
/includes/foo.php
<?php
echo "this is from foo.php";
?>
/includes/bar.php
<?php
include("foo.php");
?>
/stuff/script.php
<?php
include("../includes/bar.php");
?>
The output of script.php is "this is from foo.php," as one would expect.