note 47683 added to function.scandir
| From: | skatecrazy1 at digibase dot ca | Date: | Thu, 25 Nov 2004 06:25:22 +0000 |
| Subject: | note 47683 added to function.scandir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-81002@lists.php.net to get a copy of this message | ||
Scandir can be used to make directories of files not unlike apache's indexes, but CSS enabled
and fully customizable:
<?
//in this example, we'll say the directory is "images"
$list = scandir("images");
$i = 0;
$num = count($list);
while($i < $num){
print "<a href=\"images/$list[$i]\">$list[$i]</a><br />";
$i++;
}
?>
That will print all the files in the "images" directory linked to the files.
----
Manual Page -- http://www.php.net/manual/en/function.scandir.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47683
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47683&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47683&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47683&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47683&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47683&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47683&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47683&report=yes
Search -- http://master.php.net/manage/user-notes.php