Go directly to the code.
namespace 'Test';class A{ }
namespace 'Test';//直接运行B会报错,提示找不到AAinclude 'A.php';//加上include这句后,就可以了class B extends A{ }
What is this for? Two files in the same folder, also in the same directory, not include should also be no problem, the framework of common inheritance also does not include.
Reply content:
Go directly to the code.
namespace 'Test';class A{ }
namespace 'Test';//直接运行B会报错,提示找不到AAinclude 'A.php';//加上include这句后,就可以了class B extends A{ }
What is this for? Two files in the same folder, also in the same directory, not include should also be no problem, the framework of common inheritance also does not include.
That's because the framework has already registered itself in front of it autoload
, so when you need it A
if the current file doesn't have A
this class, then it triggers the autoload
mechanism by passing in the autoload
file that corresponds to A
the class include
.
Learn to learn the basis of it, not include how can be used, the framework must also be for the include, but for the package is good
Call AutoLoad to the default file location without the include to find a class, it is clear that the current folder is not in the default location?