note 13607 added to class.dir.php
| From: | lucas at wingedleopard dot net | Date: | Sun, 24 Jun 2001 06:47:24 +0000 |
| Subject: | note 13607 added to class.dir.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14596@lists.php.net to get a copy of this message | ||
Here's a script to read the full contents of a directory, and display links to the respective
files/folders in alphabetical order:
$i = 0;
$d = dir("./");
$dir = getcwd();
list($crap, $dir) = split("$dir/", $dir);
while($entry=$d->read()) {
if ($entry != "." &&
$entry != ".htaccess" &&
$entry != "index.php" &&
$entry != "cgi-bin") {
$enter[$i] = $entry;
$i++;
};
};
sort($enter);
for ($j=0;$j<$i;$j++){
echo("<a
href=\"$enter[$j]\"".">".$enter[$j]."</a><br>\n");
};
$d->close();
http://www.php.net/manual/en/class.dir.php