改名
This commit is contained in:
@@ -44,6 +44,7 @@ class Application extends BaseApplication
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $config = [])
|
public function __construct(array $config = [])
|
||||||
{
|
{
|
||||||
|
instance_load();
|
||||||
parent::__construct($config);
|
parent::__construct($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -335,7 +335,11 @@ class Snowflake
|
|||||||
*/
|
*/
|
||||||
public static function setAutoload($class, $file)
|
public static function setAutoload($class, $file)
|
||||||
{
|
{
|
||||||
|
if (isset(static::$_autoload[$class])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
static::$_autoload[$class] = $file;
|
static::$_autoload[$class] = $file;
|
||||||
|
include_once "$file";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -355,12 +359,5 @@ class Snowflake
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = json_decode(file_get_contents(__DIR__ . '/../composer.json'), true);
|
|
||||||
if (isset($content['autoload']) && isset($content['autoload']['psr-4'])) {
|
|
||||||
$psr4 = $content['autoload']['psr-4'];
|
|
||||||
foreach ($psr4 as $namespace => $dirname) {
|
|
||||||
classAutoload($namespace, __DIR__ . '/' . $dirname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
spl_autoload_register([Snowflake::class, 'autoload'], true, true);
|
spl_autoload_register([Snowflake::class, 'autoload'], true, true);
|
||||||
Snowflake::$container = new Container();
|
Snowflake::$container = new Container();
|
||||||
|
|||||||
@@ -69,6 +69,22 @@ if (!function_exists('loadByDir')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!function_exists('instance_load')) {
|
||||||
|
|
||||||
|
function instance_load()
|
||||||
|
{
|
||||||
|
$content = json_decode(file_get_contents(__DIR__ . '/../composer.json'), true);
|
||||||
|
if (isset($content['autoload']) && isset($content['autoload']['psr-4'])) {
|
||||||
|
$psr4 = $content['autoload']['psr-4'];
|
||||||
|
foreach ($psr4 as $namespace => $dirname) {
|
||||||
|
classAutoload($namespace, __DIR__ . '/' . $dirname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!function_exists('exif_imagetype')) {
|
if (!function_exists('exif_imagetype')) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user