note 17208 added to function.is-dir
| From: | salchicha at cable dot net dot co | Date: | Thu, 29 Nov 2001 19:45:53 +0000 |
| Subject: | note 17208 added to function.is-dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-21447@lists.php.net to get a copy of this message | ||
I've often found that under Windows NT, is_dir fails to work correctly. The way to make it work
right is to enter the total path using get_cwd(). Beneath is an example of a snippet I use to load
modules from a module dir:
// file_exists does work right
if(file_exists($dir)) {
$handle = opendir($dir) or die("Directory \"$dir\" not found.");
while($entry = readdir($handle)) {
if(is_dir(getcwd() . "/$dir/$entry") !== FALSE and $entry != ".." and
$entry != ".") {
$modules[$i] = new Module("$dir/" . $entry);
$i++;
}
}
closedir($dir);
}
--
http://www.php.net/manual/en/function.is-dir.php
http://master.php.net/manage/user-notes.php?action=edit+17208
http://master.php.net/manage/user-notes.php?action=delete+17208
http://master.php.net/manage/user-notes.php?action=reject+17208