YunpianAutoload.php 674 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: bingone
  5. * Date: 16/1/20
  6. * Time: 上午10:20
  7. */
  8. require_once(dirname(__FILE__) . DS . 'config.php');
  9. function YAutoload($classname)
  10. {
  11. $filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lib/'. $classname . '.php';
  12. echo $filename;
  13. if (is_readable($filename)) {
  14. require $filename;
  15. }
  16. }
  17. if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
  18. if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
  19. spl_autoload_register('YAutoload', true, true);
  20. } else {
  21. spl_autoload_register('YAutoload');
  22. }
  23. } else {
  24. function __autoload($classname)
  25. {
  26. YAutoload($classname);
  27. }
  28. }
  29. ?>