reaway/think-facade

v1.0.0 2021-10-19 11:48 UTC

This package is auto-updated.

Last update: 2024-04-19 18:21:45 UTC


README

安装

composer require reaway/think-facade

用法

定义一个app\facade\App类之后,即可以静态方式调用\think\App类的动态方法

<?php

namespace think;

class App
{
    public function name()
    {
        return 'app';
    }
}
<?php

namespace app\facade;

use think\Facade;

class App extends Facade
{
    /**
     * 获取当前Facade对应类名
     * @access protected
     * @return string
     */
    protected static function getFacadeClass()
    {
        return '\think\App';
    }
}

然后就可以静态方式调用动态方法了

use app\facade\App;

echo App::name(); // app