示例#1
0
            if (file_exists($file)) {
                require_once $file;
                if (DEBUG) {
                    self::$list_file .= "<li>{$file}</li>";
                }
            }
        }
    }
    static function autoload($class)
    {
        try {
            @self::loadClass($class);
            return $class;
        } catch (Exception $e) {
            return false;
        }
    }
    static function registerAutoload($class = 'AutoLoader', $enabled = true)
    {
        if (!function_exists('spl_autoload_register')) {
            throw new Exception('spl_autoload does not exist in this PHP installation');
        }
        if ($enabled === true) {
            spl_autoload_register(array($class, 'autoload'));
        } else {
            spl_autoload_unregister(array($class, 'autoload'));
        }
    }
}
AutoLoader::registerAutoload();