autoload.php 363 B

123456789101112131415
  1. <?php
  2. spl_autoload_register(function($name){
  3. $path = str_replace('\\', DIRECTORY_SEPARATOR ,$name);
  4. $path = str_replace('PHPSocketIO', '', $path);
  5. if(is_file($class_file = __DIR__ . "/$path.php"))
  6. {
  7. require_once($class_file);
  8. if(class_exists($name, false))
  9. {
  10. return true;
  11. }
  12. }
  13. return false;
  14. });