note 94825 added to function.include
| From: | WillP dot at osu1 dot php dot net | Date: | Fri, 27 Nov 2009 03:14:06 +0000 |
| Subject: | note 94825 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163320@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.197
Probable Submitter: 24.167.156.98
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit -- https://master.php.net/note/edit/94825
Del: integrated -- https://master.php.net/note/delete/94825/integrated
Del: useless -- https://master.php.net/note/delete/94825/useless
Del: bad code -- https://master.php.net/note/delete/94825/bad+code
Del: spam -- https://master.php.net/note/delete/94825/spam
Del: non-english -- https://master.php.net/note/delete/94825/non-english
Del: in docs -- https://master.php.net/note/delete/94825/in+docs
Del: other reasons-- https://master.php.net/note/delete/94825
Reject -- https://master.php.net/note/reject/94825
Search -- https://master.php.net/manage/user-notes.php