I am trying to add all files in my project recursively, for this I have used this function:
<?php
function RequireFiles()
{
$directory = new RecursiveDirectoryIterator(abspath . "lib/");
$recIterator = new RecursiveIteratorIterator($directory);
foreach ($recIterator as $item)
{
print $item->getPathname() . "<br />";
//include $item->getPathname();
}
}
?>
taken from here with minor changes.
My problem is that my output looks like this:
E:/projects/php/project/project/lib.
E:/projects/php/project/project/lib..
E:/projects/php/project/project/lib\class.
E:/projects/php/project/project/lib\class..
E:/projects/php/project/project/lib\class\Log.php
E:/projects/php/project/project/lib\trait.
E:/projects/php/project/project/lib\trait..
E:/projects/php/project/project/lib\trait\SetLink.php
E:/projects/php/project/project/lib\trait\MysqliEsp.php
E:/projects/php/project/project/lib\arrays.
E:/projects/php/project/project/lib\arrays..
E:/projects/php/project/project/lib\arrays\tables.php
I do not want to have the \.
and \..
on the end and have looked for an answer for this for a while and cannot find out how to rid myself of these little terrors!
Can someone help me to fix this or point me in the direction of a Q&A that does?