如何递归捕获任何文件[关闭]
问题描述:
The following code catches all files recursively in the php extension.
$paths = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($realPath), \RecursiveIteratorIterator::SELF_FIRST);
$files = new \RegexIterator($paths, '/\.(?:php)$/', \RegexIterator::MATCH);
foreach($files as $file){
...
I want to get files from any extension.
I want something to replace it: '/\.(?:php)$/'
以下代码以递归方式捕获php扩展名中的所有文件。 p>
$ paths = new \ RecursiveIteratorIterator(new \ RecursiveDirectoryIterator($ realPath),\ RecursiveIteratorIterator :: SELF_FIRST); $ files = new \ RegexIterator($ paths,'/\。(?:php)$ /',\ RegexIterator :: MATCH); foreach($ files as $ file){ ... code> pre>我想从任何扩展程序中获取文件。\ 我想要替换它:
'/ \。(?:php)$ /' code> p> div>
答
Wouldn't you just change
/\.(?:php)$/
to
/.*/