note 36260 added to function.include
| From: | deejaydash at uboot dot com | Date: | Thu, 02 Oct 2003 15:47:10 +0000 |
| Subject: | note 36260 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-57620@lists.php.net to get a copy of this message | ||
If you want to include lots of files, you can use this little code, instead of typing hundreds of
lines with the same command. It also checks, if the file exists and returns an error message, if
only one of the files can't be found.
<?php
$inc_files=array("file1.inc.php","../file2.inc.php"); //ARRAY WITH FILES TO
INCLUDE
for($i=0;$i<sizeof($inc_files);$i++) {
if(file_exists($inc_files[$i])) { include_once($inc_files[$i]); } else { die("File not
found: <B>$inc_files[$i]</B>"); }
}
?>
greets,
deejaydash
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+36260
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+36260&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+36260&report=yes