facade
<?php
namespace app\facade;
class Test extends \think\Facade
{
protected static function getFacadeClass()
{
return '\app\common\Test';
}
}
动态方法
<?php
namespace app\common;
class Test
{
public function hello($name)
{
return "Hello " . $name;
}
}
调用
public function index($name = 'thinkphp')
{
/**
* 如果想静态调用一个动态方法,需要给当前的类绑定一个静态代理的类
*/
return Test::hello('123');
}











网友评论