facade
<?php
namespace app\facade;
class Test extends \think\Facade
{
protected static function getFacadeClass()
{
return '\app\common\Test';
}
}
動態(tài)方法
<?php
namespace app\common;
class Test
{
public function hello($name)
{
return "Hello " . $name;
}
}
調用
public function index($name = 'thinkphp')
{
/**
* 如果想靜態(tài)調用一個動態(tài)方法,需要給當前的類綁定一個靜態(tài)代理的類
*/
return Test::hello('123');
}