jeudi 17 août 2017

listing files inside a directory in php

I want to show all the Images in a directory, and this is what I found to begin with in W3schools, I don't get what the $dh is:

if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            echo "filename: .".$file."<br />";
        }
        closedir($dh);
    }
}

I tried to echo the $dh, the output is Resource id #3.




Aucun commentaire:

Enregistrer un commentaire