read files in folder

前端 未结 4 645
一个人的身影
一个人的身影 2020-12-19 22:37

In my application there is a folder name videos. i want to raed all file only of this folder I have done almostly it does not show any folder in folder videos except .DS_St

4条回答
  •  一整个雨季
    2020-12-19 23:32

    ';
       while(($file=readdir($dh)) !== FALSE){
          $file = $dir . '/' . $file;
          if(!is_file($file) || substr($file, 0, 1) == '.'){
             continue;
          }
          printf('', htmlentities($file));
       }
       echo '';
       closedir($dh);
    }
    ?>
    

    First, if opendir fails, don't continue with junk. It ignores non-files (directories) and files starting with a dot (including ., .., .htaccess, etc.)

提交回复
热议问题