php - How can i read folder names? -
i have folder named categories has lots of folder inside.i need take names , insert database.
is there function or way takes folder names php?
just simple rtm have got you: readdir()
<?php if ($handle = opendir('/path/to/files')) { echo "directory handle: $handle\n"; echo "entries:\n"; /* correct way loop on directory. */ while (false !== ($entry = readdir($handle))) { echo "$entry\n"; } /* wrong way loop on directory. */ while ($entry = readdir($handle)) { echo "$entry\n"; } closedir($handle); } ?>
be sure read documentation gotchas!!!
Comments
Post a Comment