Jump to content

read directories inside a directory


patchido

Recommended Posts

 

 

i am getting this as a echo,

Directory handle: Resource id #2 Files: . ..

why?

 

<?
if ($handle = opendir('images')) {
    echo "Directory handle: $handle\n";
    echo "Files:\n";

    /* This is the correct way to loop over the directory. */
    while (false !== ($file = readdir($handle))){
        if (is_dir($file)){
		echo "$file\n";
	}
    }

   

    closedir($handle);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/248354-read-directories-inside-a-directory/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.