国内流行的内容管理系统(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: autoload.inc.php 1 17:44 2020-09-22 tianya $
  5. * @package DedeCMS.Libraries
  6. * @copyright Copyright (c) 2007 - 2018, DesDev, Inc.
  7. * @copyright Copyright (c) 2020, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license/v6
  9. * @link https://www.dedebiz.com
  10. */
  11. function __autoload($classname)
  12. {
  13. $classname = preg_replace("/[^0-9a-z_]/i", '', $classname);
  14. if( class_exists ( $classname ) )
  15. {
  16. return TRUE;
  17. }
  18. $classfile = $classname.'.php';
  19. $libclassfile = $classname.'.class.php';
  20. if ( is_file ( DEDEINC.'/'.$libclassfile ) )
  21. {
  22. require DEDEINC.'/'.$libclassfile;
  23. }
  24. else if( is_file ( DEDEMODEL.'/'.$classfile ) )
  25. {
  26. require DEDEMODEL.'/'.$classfile;
  27. }
  28. else
  29. {
  30. if (DEBUG_LEVEL === TRUE)
  31. {
  32. echo '<pre>';
  33. echo $classname.'类找不到';
  34. echo '</pre>';
  35. exit ();
  36. }
  37. else
  38. {
  39. header ( "location:/404.html" );
  40. die ();
  41. }
  42. }
  43. }
  44. ?>