note 11859 added to function.require-once.php
| From: | php-general at lists dot php dot net | Date: | Sat, 10 Mar 2001 02:53:25 +0000 |
| Subject: | note 11859 added to function.require-once.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12153@lists.php.net to get a copy of this message | ||
Unlike C #include, PHP's require() and require_once() don't handle relative paths
correctly. A relative path in these two functions is respective to the location of the
"topmost" script, but not to the location of the file where these functions placed. This
pretty much makes these functions useless. For functions include() and include_once() there is a
work-around -- realpath(). For instance:
include_once( realpath( '../include/common.inc' ) )
http://www.php.net/manual/en/function.require-once.php