note 81969 added to function.scandir
| From: | swaitch at osu1 dot php dot net | Date: | Fri, 21 Mar 2008 16:26:06 +0000 |
| Subject: | note 81969 added to function.scandir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-137271@lists.php.net to get a copy of this message | ||
This script worked perfectly for me in removing the . and .. plus made the files into links for
quick viewing. Might be handy.
<?php
$dir = '../quickhelp/Accounts'; // Your Directory
$files = scandir($dir, 0);
for( $ctr = 1; $ctr < sizeof( $files ); $ctr++ ) {
if($files[$ctr] != "." && $files[$ctr] != "..")
print "<li><a href='Accounts/$files[$ctr]'
target='viewer'>$files[$ctr]</a></li>";
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 207.109.151.162
----
Manual Page -- http://www.php.net/manual/en/function.scandir.php
Edit -- https://master.php.net/note/edit/81969
Del: integrated -- https://master.php.net/note/delete/81969/integrated
Del: useless -- https://master.php.net/note/delete/81969/useless
Del: bad code -- https://master.php.net/note/delete/81969/bad+code
Del: spam -- https://master.php.net/note/delete/81969/spam
Del: non-english -- https://master.php.net/note/delete/81969/non-english
Del: in docs -- https://master.php.net/note/delete/81969/in+docs
Del: other reasons-- https://master.php.net/note/delete/81969
Reject -- https://master.php.net/note/reject/81969
Search -- https://master.php.net/manage/user-notes.php