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

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -