PHP Regex specify multiple paths using glob()

前端 未结 2 1602
栀梦
栀梦 2021-01-18 00:52
glob(\"aaafolder/*php\")
glob(\"bbbfolder/*php\")
glob(\"cccfolder/*php\")

Is it possible to simplify this?

glob(\"(?=aaafolder/*p         


        
2条回答
  •  醉酒成梦
    2021-01-18 01:39

    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 ;-)

提交回复
热议问题