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


/ Published in: PHP
Save to your folder(s)

php list files and directories beginning with ....

1 paramètre d'entrée


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.