Posted By

martinbrait on 07/29/19


Tagged

list dir files


Versions (?)

Lister répertoires et fichiers commençant par ...


 / Published in: PHP
 

php list files and directories beginning with ....

1 paramètre d'entrée

  1. <?php
  2.  
  3. function listfile($sbegin)
  4. {
  5. // lister fichiers et répertoires commençant par...
  6. $filelist = array();
  7. if ($handle = opendir(".")) {
  8. while ($entry = readdir($handle)) {
  9. if (strpos($entry, $sbegin) === 0) {
  10. $filelist[] = $entry;
  11. }
  12. }
  13. closedir($handle);
  14. print_r ($filelist);
  15. }
  16. }
  17.  
  18. listfile('c');
  19. ?>

Report this snippet  

You need to login to post a comment.