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

PHP function to list directory contents under windows

WBOY
Release: 2016-07-25 09:07:33
Original
853 people have browsed it
  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. ?>
复制代码


source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template