For example - this function uses a facade:
File::get('path/to/file.txt');
事实证明,实际提供File::get
的底层类是Illuminate\Filesystem\Filesystem
我查看了Laravel 4.2文档——这是我使用的版本——以及api参考,但我找不到任何东西可以向不知道如何找到facade的"真实"类的人解释.
这tutorial on Laravel facades条给出了一种做这件事的方法,包括
- 寻找
File
级 - looking to see that it extends class
Facade
- 通过
Facade#__callstatic()
方法跟踪代码 - 当
getFacadeAccessor()
返回字符串files
时跟踪__callstatic()
、resolveFacadeInstance()
的行为 - 等等等等
- ... too long / many steps to post
This is a good demonstration of whats going on, but I wouldn't want to do this regularly.
My question is, knowing that the "facaded classes" you use in your app dont necessarily have a the same name or some convention to help you search the filesystem, how can someone - who doesn't know in advance what the underlying class is - find the underlying class for a laravel facade?