note 74997 deleted from function.opendir by cmb
| From: | cmb@php.net | Date: | Tue, 11 Jun 2019 06:39:36 +0000 |
| Subject: | note 74997 deleted from function.opendir by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211222@lists.php.net to get a copy of this message | ||
Note Submitter: Dblurred
----
In reponse to Tozeiler. Nice short directory dump. However, that displays the "." and
"..". This removes those. It also makes an ordered list in case I needed to be on the
phone while looking at the page. Easy to call out.
<?php
$path = "your path";
$dh = opendir($path);
$i=1;
while (($file = readdir($dh)) !== false) {
if($file != "." && $file != "..") {
echo "$i. <a href='$path/$file'>$file</a><br />";
$i++;
}
}
closedir($dh);
?>