Skip to content

reaway/think-facade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

think-facade

安装

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages