Re: Problems with is_dir()
| From: | Ni Shurong | Date: | Thu, 29 Jul 2004 12:15:36 +0000 |
| Subject: | Re: Problems with is_dir() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-192174@lists.php.net to get a copy of this message | ||
you must do it like this:
<?php
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"]."/img")) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
+ $path = $_SERVER["DOCUMENT_ROOT"]."/img" . "/"
. $file;
! if (is_dir($path)){
echo "Dir: ".$file;
}
else
{
echo "File: ".$file;
}
echo "<br />";
}
}
closedir($handle);
clearstatcache();
}
?>
----
Ni Shurong <srni@gzlinux.org>
MAIL : srni@gzlinux.org
QQ : 412844
MSN : nsr_xh@hotmail.com
BLOG : http://blog.njmars.com/myhan/