[Laravel] basic use of Laravel [Laravel] basic HTTP route of Laravel & nbsp; use the basic route of Laravel to implement get request response and find the file appHttproutes. php calls the Route static method get () to implement the get Response. the parameter is a string-type path, and the anonymous function () {} is inside the anonymous function, returns string data & [Laravel] Basic usage of Laravel
[Laravel] basic HTTP routing of Laravel
Use the basic routing of Laravel to implement get request response and find the file app/Http/routes. php
Call the Route static method get () to implement get Response. parameter: string path, anonymous function (){}
Returns string data within an anonymous function.
Post, put, and delete requests, same as above
Implement the Route for passing parameters through get, call the Route static method get (), parameters: Path, anonymous function
Path, parameter name of the braces, excluding $, for example, '/user/{id }'
Anonymous function, receiving parameters, such as: function ($ id ){}
[Laravel] basic controller of Laraval
Create an Index/IndexController. php file in the app/Http/Controllers directory.
Define namespace App \ Http \ Controllers \ Index
Introduce the Controller basic Controller, use App \ Http \ Controllers \ Controller
Define IndexController to inherit Controller
Implementation method index, return data
Define the behavior of a Route controller, for example, Route: get ("/index", "Index \ [email protected]");,
Note that in the namespace section, the newly created controller is under the root namespace. add the newly added namespace when specified.
[Laravel] basic view of Laravel
Under the resources/views/directory, create index/index. php
Use the function view () in the controller to call the template. parameters: file path (. separated directory), data
Route: routes. php
['Web'], function (){//});
Controller: IndexController. php
Template: index. php