note 75528 modified in function.include by danbrown

From: Date: Mon, 18 May 2009 00:59:09 +0000
Subject: note 75528 modified in function.include by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155459@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: <?php 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. --was-- 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. http://php.net/manual/en/function.include.php

« previous php.notes (#155459) next »