Re: Novice PHP Question - Listing Folder Contents
| From: | JM Guillermin | Date: | Tue, 10 Apr 2007 22:35:54 +0000 |
| Subject: | Re: Novice PHP Question - Listing Folder Contents | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252491@lists.php.net to get a copy of this message | ||
http://www.php.net/readdir
<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "$file\n";
}
}
closedir($handle);
}
?>
cheers
jmg
----- Original Message ----- From: "revDAVE" <coolcat@hosting4days.com>
To: <php-general@lists.php.net>
Sent: Tuesday, April 10, 2007 10:11 PM
Subject: [PHP] Novice PHP Question - Listing Folder Contents
I apologize in advance, however I know almost nothing about PHP - ( but I am trying to learn now)... I am wondering if it is possible to create a PHP page that can: 1 - Get the contents of everything in its own folder at the same level ( just list sub folders filenames - not their contents) 2 - List/ display the contents on the same Web-page Q: I'm sure this is most likely doable - but I sure could use some help - any ideas how to do this? Example list: file1.php file2.php file22.txt file1.pdf - that sort of thing -- Thanks - RevDave CoolCat@hosting4days.com [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php