通过php查找目录中的所有mp3文件

Is there any way that php can find all the mp3 files in a directory(even inside sub directories)? So you don't have to find them manually and you can add music easier?

You can try the glob() function:

print_r(glob("*.mp3"));

This will give you all files including sub-directories.

$Regex will have single index array of all files you need.

<?php    
$Directory = new RecursiveDirectoryIterator('path/to/project/');
$Iterator = new RecursiveIteratorIterator($Directory);
$Regex = new RegexIterator($Iterator, '/^.+\.mp3$/i', RecursiveRegexIterator::GET_MATCH);
?>