Reading Contents from a Directory : Directory « File Directory « PHP
- PHP
- File Directory
- Directory
Reading Contents from a Directory
<?php
if (file_exists ("./")) {
if (is_dir ("./")) {
$dh = opendir ("./") or die (" Directory Open failed !");
while ($file = readdir ($dh)) {
echo "$file\n";
}
echo "Directory was opened successfully";
Closedir ($dh);
}
}
?>
Related examples in the same category