LoginSignup
2
2

More than 5 years have passed since last update.

ディレクトリ中のディレクトリ

Posted at
dirs.php
<?php
function scan_dir_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) === false ){ unset($list[$idx] ) ;continue;} 
      $list[$idx] = getcwd()."/".$dirname;
  };
  chdir($cwd);
  if(!$list){return array();}
  return $list;
}

ディレクトリ中のあるディレクトリ。再帰はしない。

2
2
0

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
2
2