How can I get a listing of all files from multiple folders using the PHP glob()
function?
Something like this: glob("data/['folder1', 'folder2']/*");
如glob
文档中a
,只要使用GLOB_BRACE
标志,就可以展开{a,b,c}
来匹配a
, b
或c
。
glob("data/{folder1,folder2}/*", GLOB_BRACE);
如果您不想指定子目录,请尝试:
$all_files = glob("{data/*/*}", GLOB_BRACE);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.