Home  >  Article  >  Backend Development  >  PHP function to list directory contents under windows

PHP function to list directory contents under windows

WBOY
WBOYOriginal
2016-07-25 09:07:33833browse
  1. function list_files($dir)
  2. {
  3. if(is_dir($dir))
  4. {
  5. if($handle = opendir($dir))
  6. {
  7. while(($file = readdir($handle)) !== false)
  8. {
  9. if($file != "." && $file != ".." && $file != "Thumbs.db")
  10. {
  11. echo ''.$file.'
    '."n";
  12. }
  13. }
  14. closedir($handle);
  15. }
  16. }
  17. }
  18. ?>
复制代码


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn