note 13913 added to function.readdir.php
| From: | miandad_r at hotmail dot com | Date: | Tue, 10 Jul 2001 04:39:32 +0000 |
| Subject: | note 13913 added to function.readdir.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15148@lists.php.net to get a copy of this message | ||
well this is for people who have a bunch of word documents and pdf documents... who want to list
them and show the date modified or uploaded... this is good for people who have user manuals and
other important documents to show....
<?
$handle=opendir('.');
while (false!==($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file !=
"index.phtml") {
$filename = str_replace("_"," ",$file);
$fTime = filemtime($file);
$today = getdate($fTime);
$month = $today['month'];
$mday = $today['mday'];
$year = $today['year'];
$filename = str_replace(".pdf","",$filename);
$filename = str_replace(".doc","",$filename);
echo "<li><b><a href=$file target=_blank>$filename</a></b>
-<font size=1> Last update on <font color=red>$month $mday,
$year</font></font></li><br>";
}
}
closedir($handle);
?>
http://www.php.net/manual/en/function.readdir.php