mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-15 04:02:47 +00:00
33 lines
791 B
PHP
33 lines
791 B
PHP
<?php
|
|
|
|
namespace core\printer\sdk\yilianyun;
|
|
|
|
class Autoloader{
|
|
|
|
public static function loadByNamespace($name)
|
|
{
|
|
$class_path = str_replace('\\', DIRECTORY_SEPARATOR, $name);
|
|
if (strpos($name, 'App\\') === 0) {
|
|
$class_file = __DIR__ . substr($class_path, strlen('App')) . '.php';
|
|
}elseif(empty($class_file) || !is_file($class_file)){
|
|
$class_file = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $class_path . ".php";
|
|
}
|
|
if (is_file($class_file)) {
|
|
require_once ($class_file);
|
|
if (class_exists($name, false)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
spl_autoload_register('\core\printer\sdk\yilianyun\Autoloader::loadByNamespace');
|
|
|
|
|
|
|
|
|
|
|