Encountered this problem when binding facade
//Successful binding
Facade::bind('app\index\facade\Human','app\index\ Common\Human');
Facade::bind('app\index\facade\Human','\app\index\Common\Human');
//Failed binding Define
Facade::bind('\app\index\facade\Human','\app\index\Common\Human');
Xiaobai wants to know why the app is in front of the binding \ cannot be added. Doesn’t it mean starting from the root?
天蓬老师2019-02-22 16:31:29
This is just like you use the "use" keyword to alias the referenced class. The default is to start from the root space,
For example:
namespace test; use app\admin; // 与下面写法是完全一样的 namespace test; user \app\admin; // 默认就是全局空间开始查找
If you want to understand Facade::bind() parameter, you can view the source code of the Facade class. In the source code, there is a detailed description of the bind() method