: This article mainly introduces Yii Source Code explanation-automatic class loading. For more information about PHP tutorials, see. Implementation
Yii class is automatically loaded, depending on PHP'sSpl_autoload_register ()
Register your own autoloader function and insert it to the very beginning of the auto-load function stack to ensure that the Yii autoloader will be called first.
Require (_ DIR _. '/.../../vendor/autoload. php ');
Require (_ DIR _. '/.../../vendor/yiisoft/yii2/Yii. php ');
First, the third-party autoloader is loaded, and then the Yii autoloader is loaded.
Finally, load the Yii autoloader to ensure that Yii is preferentially loaded.
Yii. php
You can view the call of the autoloader code.BaseYii: autoload ()
Register as autoloader.
The calledClasses. php
All core classes are included.
Reference
Http://www.digpage.com/autoload.html
The above introduces the Yii Source Code explanation-automatic class loading, including some content, and hope to be helpful to friends who are interested in PHP tutorials.