note 74997 added to function.opendir
| From: | Dblurred at osu1 dot php dot net | Date: | Tue, 08 May 2007 00:04:01 +0000 |
| Subject: | note 74997 added to function.opendir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126309@lists.php.net to get a copy of this message | ||
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);
?>
----
Server IP: 69.39.81.135
Probable Submitter: 71.103.26.70
----
Manual Page -- http://www.php.net/manual/en/function.opendir.php
Edit -- https://master.php.net/note/edit/74997
Del: integrated -- https://master.php.net/note/delete/74997/integrated
Del: useless -- https://master.php.net/note/delete/74997/useless
Del: bad code -- https://master.php.net/note/delete/74997/bad+code
Del: spam -- https://master.php.net/note/delete/74997/spam
Del: non-english -- https://master.php.net/note/delete/74997/non-english
Del: in docs -- https://master.php.net/note/delete/74997/in+docs
Del: other reasons-- https://master.php.net/note/delete/74997
Reject -- https://master.php.net/note/reject/74997
Search -- https://master.php.net/manage/user-notes.php