Daily laravel[002]-automatic loading function process

When you need to turn on automatic loading. Under normal circumstances, the automatic processing function is registered!

Step 1: First define the opening time

define('LARAVEL_START'microtime(true));

Step 2: Include the core functions in the system framework. Let's take a look at how the core functions are automatically loaded?

require __DIR__.'/../vendor/autoload.php';

Step 3: Generally, there will be a cache generation mechanism for such automatically loaded files. If the system settings allow the generation of cache files, load the generated cache files directly!

Next, let's judge whether the path of the cache file and whether the file exists, if it exists, it will be included!

 

Step 4: Get the location of the cache file

$compiledPath = __DIR__.'/cache/compiled.php';

If the cache file exists, it will be included. But in general, this file does not exist

 

if (file_exists($compiledPath)) {
    require $compiledPath;

}

This is a typical MVC file loading process!

For more original creations, please search for Qianfeng Education and use your conscience to educate!

Guess you like

Origin blog.csdn.net/chengshaolei2012/article/details/72669548