<?php
namespace app;
static $container = [];
function app($class) {
global $container;
if (empty($container[$class])) $container[$class] = new $class();
return $container[$class];
}
abstract class Facade {
abstract public static function getFacadeClass(): string;
public static function __callStatic($name, $arguments) {
$obj = app(static::getFacadeClass());
return $obj->$name(...$arguments);
}
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結