<?php
namespace think;
class facade{
(资料图片)
protected static function getFacadeClass()
{}
// 调用实际类的方法
public static function __callStatic($method, $params)
{
return call_user_func_array( [static::createFacade(), $method], $params);
}
protected static function createFacade($class = '', $args = [])
{
$class = $class ?: static::class; //think\facade\Test
$class=static::getFacadeClass();
//$class='think\\'.$class;
return new $class;
}
}
namespace think\facade;
class a extends \think\facade
{
protected static function getFacadeClass()
{
return 'think\\a';
}
}
namespace think;
class a{
public function show()
{
echo '我是a类,但不是静态方法';
}
}
\think\facade\a::show();
?>
关键词: