note 18286 deleted from function.include-once by sniper
| From: | sniper@php.net | Date: | Tue, 04 Nov 2003 00:43:42 +0000 |
| Subject: | note 18286 deleted from function.include-once by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59804@lists.php.net to get a copy of this message | ||
Note Submitter: oliver@samera.com.py
----
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);
}
}