国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
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.

45 lines
1.1KB

  1. <?php
  2. if(!defined('DEDEINC')) exit("Request Error!");
  3. /**
  4. * @version $Id: autoload7.inc.php 1 17:44 2020-09-22 tianya $
  5. * @package DedeCMS.Libraries
  6. * @copyright Copyright (c) 2020, DedeBIZ.COM
  7. * @license https://www.dedebiz.com/license
  8. * @link https://www.dedebiz.com
  9. */
  10. function dede_autoloader($classname)
  11. {
  12. $classname = preg_replace("/[^0-9a-z_]/i", '', $classname);
  13. if( class_exists ( $classname ) )
  14. {
  15. return TRUE;
  16. }
  17. $classfile = $classname.'.php';
  18. $libclassfile = $classname.'.class.php';
  19. if ( is_file ( DEDEINC.'/'.$libclassfile ) )
  20. {
  21. require DEDEINC.'/'.$libclassfile;
  22. }
  23. else if( is_file ( DEDEMODEL.'/'.$classfile ) )
  24. {
  25. require DEDEMODEL.'/'.$classfile;
  26. }
  27. else
  28. {
  29. if (DEBUG_LEVEL === TRUE)
  30. {
  31. echo '<pre>';
  32. echo $classname.'类找不到';
  33. echo '</pre>';
  34. exit ();
  35. }
  36. else
  37. {
  38. header ( "location:/404.html" );
  39. die ();
  40. }
  41. }
  42. }
  43. spl_autoload_register('dede_autoloader');
  44. ?>