简体   繁体   中英

PHP glob select 2 folders

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}来匹配abc

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM