我一直在努力创建一个cookie ......
<?php
class Singleton{
private static $instance = null;
protected function __construct(array $config = []){
//do something...
}
public static function getInstance(array $config = []){
$className = get_called_class();
if (!isset(self::$instance[$className])){
self::$instance[$className] = new static($config);
}
return self::$instance[$className];
}
}
class likeDB extends Singleton{
//...
}
function callbackRF($className, $methodName, array $args = [], array $params = []){
//do something...
$class = new ReflectionClass($className);
//throw Exception
$instance = $class->newInstanceArgs($args);
//do something ...
}
但每次,我都会在控制台中查看,输出完全是空白的。我使用了错误的语法或其他东西吗?