1<?php 2 3error_reporting(E_ALL); 4 5function getGeneratedFiles($dir, &$results = array()) 6{ 7 $files = scandir($dir); 8 9 foreach ($files as $key => $value) { 10 $path = realpath($dir.DIRECTORY_SEPARATOR.$value); 11 if (!is_dir($path)) { 12 $results[] = $path; 13 } else if ($value != "." && $value != "..") { 14 getGeneratedFiles($path, $results); 15 } 16 } 17 return $results; 18} 19 20foreach (getGeneratedFiles("generated") as $filename) 21{ 22 if (!is_dir($filename)) { 23 include_once $filename; 24 } 25 26} 27 28