note 75528 added to function.include
| From: | post-nospam at brucemiller dot co dot uk | Date: | Mon, 04 Jun 2007 09:07:49 +0000 |
| Subject: | note 75528 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127178@lists.php.net to get a copy of this message | ||
A very EASY way to get 'include' to find its way to another directory, other than setting
the 'include path', and useful for fetching one or two files:
include ($_SERVER['DOCUMENT_ROOT']."/foo/bar.php");
This creates an include that is relative to the root rather than the current directory.
The dot is for concatenation, not current directory, as with 'include path' syntax.
See Appendix M of Manual > Reserved words > Predefined Variables, for more info on $SERVER.
----
Server IP: 69.39.81.135
Probable Submitter: 80.104.1.243
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit -- https://master.php.net/note/edit/75528
Del: integrated -- https://master.php.net/note/delete/75528/integrated
Del: useless -- https://master.php.net/note/delete/75528/useless
Del: bad code -- https://master.php.net/note/delete/75528/bad+code
Del: spam -- https://master.php.net/note/delete/75528/spam
Del: non-english -- https://master.php.net/note/delete/75528/non-english
Del: in docs -- https://master.php.net/note/delete/75528/in+docs
Del: other reasons-- https://master.php.net/note/delete/75528
Reject -- https://master.php.net/note/reject/75528
Search -- https://master.php.net/manage/user-notes.php