PHP正则表达式使用glob()指定多个路径 [英] PHP Regex specify multiple paths using glob()
本文介绍了PHP正则表达式使用glob()指定多个路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
glob(bbbfolder / * php)
glob(cccfolder / * php)
可以简化吗?
glob((?= aaafolder / * php)(?= bbbfolder / * php)(?= cccfolder / * php ))
上面没有返回任何内容。
解决方案
此笔记 glob()
的手册页 似乎回答了你的问题,说glob不限于单一目录:使用 GLOB_BRACE
,您可以指定多个目录。
我引用了 @Ultimater
给出的例子:
$结果=水珠( {包括/ * PHP中,核心/ * PHP。},GLOB_BRACE);
手册页面上的用户注释通常包含有用的信息和例子; - )
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.
I'm quoting the example that @Ultimater
gives there :
$results=glob("{includes/*.php,core/*.php}",GLOB_BRACE);
User-notes on the manual pages often contain useful informations and examples ;-)
这篇关于PHP正则表达式使用glob()指定多个路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文