<?php
$regex = "([^\/]+).mp3$";
$dir =".";
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ( preg_match ( "/".$regex."/", $file, $matches) ) {
echo $file;
$files[] = $file;
// $matches[1]で名前だけとるのもあり。
}
}
closedir($handle);
}
?>
No comments:
Post a Comment