LoginSignup
4
4

More than 5 years have passed since last update.

ディレクトリ中のファイルを一覧

Posted at
function scan_files_in_dir($dir){ 
  $cwd = getcwd(); 
  chdir($dir); 
  $list = scandir("$dir/vendor") ; 
  foreach( $list  as $idx=> $dirname){ 
      if( $dirname == "." ){ unset($list[$idx] ); continue; } 
      if( $dirname == ".." ){ unset($list[$idx] ); continue;} 
      if( is_dir($dirname) === true ){ unset($list[$idx] ) ;continue;} 
      $list[$idx] = getcwd()."/".$dirname;
  };
  chdir($cwd);
  if(!$list){return array();}
  return $list;
}

ディレクトリ一覧中のファイル。再帰はしない。

4
4
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4