autoload.php 522 B

123456789101112131415161718
  1. <?php
  2. /**
  3. * 自动载入
  4. *
  5. * @author Flc <2016-10-25 17:35:52>
  6. * @link http://flc.ren
  7. */
  8. spl_autoload_register(function ($classname) {
  9. $baseDir = __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Alidayu' . DIRECTORY_SEPARATOR;
  10. if (strpos($classname, "Flc\\Alidayu\\") === 0) {
  11. $path = str_replace('\\', DIRECTORY_SEPARATOR, substr($classname, strlen('Flc\\Alidayu\\')));
  12. $file = $baseDir . $path . '.php';
  13. if (is_file($file))
  14. require_once $file;
  15. }
  16. });