5
How do I recursively grab all files *.php
? With the code below caught all that are root, but wanted to get from all directories.
I tried to use RecursiveDirectoryIterator
, or use some functions I found on Soen, kind of, but nothing...
function getPageFiles()
{
$directory = '';
$pages = glob($directory . "*.php");
//print each file name
foreach ($pages as $page){
$row[$page] = $page;
}
return $row;
}
All directories as well ? Including the base ?
– Edilson
@Edilson The files
.php
who are in the/
(out of directories, only in/
) enter the list, but those inside a directory do not (for example, files in/view/, or /model/ do not enter the list, and I need them to enter...– gustavox
- All right, see if this helps.
– Edilson
I made a class for this, it is of specific use, but check it out - https://gist.github.com/jonataswalker/3c0c6b26eabb2e36bc90
– Jonatas Walker
@Jonataswalker really seemed nice your class, congratulations... in my specific case it will not be possible to use neither yours nor the solution that @Edilson posted, because the mini framework that I’m using for authentication is limited, and only protects the pages that are on
/
, so even if you can pull all the files to the list (where you set the permissions), the protection doesn’t work... For those who are interested, see the last answer of this topic. The system is super simple and easy to use, but it has this annoying limitation :/...– gustavox