[英]PHP Regex specify multiple paths using glob()
glob("aaafolder/*php")
glob("bbbfolder/*php")
glob("cccfolder/*php")
Is it possible to simplify this? 有可能简化这个吗?
glob("(?=aaafolder/*php)(?=bbbfolder/*php)(?=cccfolder/*php)")
The above returns nothing. 以上都没有回报。
This note on the manual page of glob()
seems to answer your question, saying that glob is not limited to a single directory : using GLOB_BRACE
, you can specify several directories. glob()
手册页上的这个注释似乎回答了你的问题,说glob不仅限于一个目录:使用GLOB_BRACE
,你可以指定几个目录。
I'm quoting the example that @Ultimater
gives there : 我引用了
@Ultimater
给出的例子:
$results=glob("{includes/*.php,core/*.php}",GLOB_BRACE);
User-notes on the manual pages often contain useful informations and examples ;-) 手册页上的用户注释通常包含有用的信息和示例;-)
正如PHP手册所说,它的GLOB_BRACE
标志。
glob("{aaafolder/*php,bbbfolder/*php,cccfolder/*php}", GLOB_BRACE)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.