Laravel every day

Day 1: Start learning the laravel framework. First understand the running process of laravel

The first step: include the automatic loading file

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

Composer provides a convenient and automatic generation of class loading for our application. We need to use it! We simply include this file in our script file, so that we don't worry about manually loading it during later use!

This feeling makes us very relaxed!

Step 2: Load the app entry file

$app = require_once __DIR__.'/../bootstrap/app.php';

Turn on the lights!

We need to illuminate the development of PHP, so let's turn on the lights! The bootstraps framework and get ready for the application, and then he can load the application so we can run the application back to the browser and make our users happy!

Step 3: Start running the application

Once we build an application, we can process the increased request through the kernel, and send the relevant response back to the client browser to create and perfect the application we prepared to the user.

Once we build the application, we can process the request through the kernel and return the relevant response to the client browser, allowing users to enjoy the perfect application we have prepared.

3.1 Get the instantiated kernel program!

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

::class means get the complete class name!

$app->make is similar to our linux here! Is to generate the instantiation of the corresponding class 

3.2 Obtaining feedback data by obtaining user requests 

$response = $kernel->handle($request = Illuminate\Http\Request::capture());

$request = Illumiate\Http\Request::capture(); Use this get function to capture the user's request/input information

Send the input information as a parameter to the return information processing part

$response = $kernel->handle($request);

 

3.3 Format and output the returned information

$response->send();

Formatted output, it may be Html format, or json format!

 

3.4 Termination request and feedback data

$kernel->terminate($request, $response);

Process the request to complete the mission and the corresponding data!

Complete the entire initialization process!

Simply put:

First: prepare to automate the loading process!

Second: Prepare the application entry file

Third: instantiate the kernel program

Fourth: return data according to the entrance request activity

Fifth: Return data formatting

Sixth: Clean up relevant data.

For more cutting-edge PHP technologies, please search Qianfeng PHP, be your true self, and use your conscience for education

Original post address: https://my.oschina.net/u/3434164/blog/906454

For more cutting-edge PHP technologies, please search Qianfeng PHP, be your true self, and use your conscience for education

Original post address: https://my.oschina.net/u/3434164/blog/906454

Guess you like

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