84669 人学习
152542 人学习
20005 人学习
5487 人学习
7821 人学习
359900 人学习
3350 人学习
180660 人学习
48569 人学习
18603 人学习
40936 人学习
1549 人学习
1183 人学习
32909 人学习
larave 项目中静态调用
facade
Admin类中的title方法是非静态的
这个是如何实现的?
人生最曼妙的风景,竟是内心的淡定与从容!
归根结底是通过 魔术方法 __callStatic 实现的
魔术方法 __callStatic
IlluminateSupportFacadesFacade 代码最下方
IlluminateSupportFacadesFacade
https://github.com/illuminate...
/** * Handle dynamic, static calls to the object. * * @param string $method * @param array $args * @return mixed * * @throws \RuntimeException */ public static function __callStatic($method, $args) { $instance = static::getFacadeRoot(); if (! $instance) { throw new RuntimeException('A facade root has not been set.'); } return $instance->$method(...$args); }
关于 Facade 是 Lavavel 比较重要的特性之一,可以详细了解下它的实现。
Facade
Lavavel
归根结底是通过
魔术方法 __callStatic
实现的IlluminateSupportFacadesFacade
代码最下方https://github.com/illuminate...
关于
Facade
是Lavavel
比较重要的特性之一,可以详细了解下它的实现。