note 81897 deleted from function.readdir by peehaa
| From: | peehaa@php.net | Date: | Fri, 19 May 2017 12:55:14 +0000 |
| Subject: | note 81897 deleted from function.readdir by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209070@lists.php.net to get a copy of this message | ||
Note Submitter: dbzfanatic_1 at hotmail dot com
----
Here's an easy way to output the contents as a list of download links.
<?php
$count = 0;
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {$count++;
print("<a
href=\"".$file."\">".$file."</a><br />\n");
}
}
echo '<br /><br /><a href="..">Return</a>';
closedir($handle);
}
?>
and simply use $count to list the overall number of files.