note 22911 deleted from function.get-included-files by sniper
| From: | sniper@php.net | Date: | Thu, 25 Sep 2003 17:25:14 +0000 |
| Subject: | note 22911 deleted from function.get-included-files by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57124@lists.php.net to get a copy of this message | ||
Note Submitter: davey@its-explosive.net
----
When using this function with PHP 4.2.1, I got this output for
"print_r(get_included_files());" which hints at the fact that the array may actually
contain full paths, not just the filenames as the example shows.
Array ( [0] => /usr/home/sites/x.its-explosive.net/web/Misc. Classes/get_text.class.php [1] =>
/usr/home/sites/x.its-explosive.net/web/Misc. Classes/dic/es.lang.php [2] =>
/usr/home/sites/x.its-explosive.net/web/Misc. Classes/buffer.class.php )
If you're looking for a specific filename, I suggest using something like:
$is_included = get_included_files();
foreach ($is_included as $i) {
$files = explode("/",$i);
$is_included = in_array("file.php",$files);
if ($is_included == TRUE) {
break;
}
}
if($is_included != TRUE) {
if(file_exists("file.php")) {
include("file.php");
}
}