note 18286 added to function.include-once
| From: | oliver at samera dot com dot py | Date: | Thu, 17 Jan 2002 07:26:07 +0000 |
| Subject: | note 18286 added to function.include-once | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-24968@lists.php.net to get a copy of this message | ||
If you call twice include_once() using the same include file, the second include_once() will return
false.
So, you have to use get_included_files() to check if the file was already included or if the file
does not exist.
$res = include_once('path/file.inc');
if(!res) {
if( !in_array('path/file.inc', get_included_files()) ) {
echo "The file 'path/file.inc' does not exists";
exit(1);
}
}
--
http://www.php.net/manual/en/function.include-once.php
http://master.php.net/manage/user-notes.php?action=edit+18286
http://master.php.net/manage/user-notes.php?action=delete+18286
http://master.php.net/manage/user-notes.php?action=reject+18286