白云图书馆管理系统 —— 课程作业项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

26 lines
793 B

<?php
class autoload {
public function __construct() {
require(APP_ROOT.'/config.php');
require(APP_ROOT.'/src/router.php');
$this->auto_require_files(APP_ROOT.'/src/model');
$this->auto_require_files(APP_ROOT.'/src/controller');
}
private function auto_require_files($dir) {
foreach ($this->scan_dir_files($dir) as $file) require($file);
}
private function scan_dir_files($dir) {
foreach (scandir($dir) as $item) {
if ($item != '..' && $item != '.') {
if (is_dir($dir.'/'.$item)) {
$files = array_merge($files, $this->scan_dir_files($dir.'/'.$item));
} else $files[] = $dir.'/'.$item;
}
}
return $files;
}
}