Created
February 7, 2012 09:16
-
-
Save takuya/1758507 to your computer and use it in GitHub Desktop.
ディレクトリ中のファイルを一覧 ref: http://qiita.com/items/2041
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment