• notice
  • Congratulations on the launch of the Sought Tech site

About the routing configuration in Laravel's routing routes.php

Friends who have never been in contact with the laravel framework will hate Laravel's routing when they use laravel for the first time, because it and other frameworks It's so different.Like YII and THINKPHP, there is basically no need to configure it.After the controller method is brought into the URL, the corresponding controller method will be automatically called, but laravel is different.All controller methods need to be pointed out in the routing file, some just touched Laravel, but people who are not in deep contact think that every controller or even every method of laravel needs to add a route control, which is a mistake.Basically, one routing rule per controller is sufficient.Let’s look at a simple routing control:

//test routing control 

span>Route::get ('testdata/product',<'
);
Like the routing control above, it means that adding testdata/product in the URL will enter the product method in the specified TestdataController controller.Note that The product method, not the getProduct or postProduct method.Look at the following route:
Route::controller('home',< span class="str">'HomeController');
This route means that all URL requests whose controller is home are in the homeContrller controller The corresponding method, we should pay attention here, use Route:: The routing rules set by the controller distinguish between get and post methods during access, so if your page is for get access, call the getMethod method in the controller, and if it is a post, the corresponding postMethod method will be called.After distinguishing the difference between these two routes, the following is easy to handle.Take a look at complex routing control:
Route::controller('shop/login', '\\Shop\\LoginController'); Route::Redirect::guest('shop/login');  } });
The auth rules in this filter It is judged whether the user passes the login verification, and if it fails the verification, it will jump to the login page.

After understanding the routing rules in laravel, other things are almost the same as other frameworks, and the frameworks are almost the same.I used YII for two years before doing a project with Laravel this year, and the laravel framework is very popular.Yes, to be honest, I don't think it has any good, sometimes I feel that it is learning YII everywhere.Maybe after the framework is big, it will be the same.

/span>guest('shop/login'); } }); The auth rule in this filter determines whether the user has passed the login verification, and if it fails the verification, it will jump to the login page.

After understanding the routing rules in laravel, other things are almost the same as other frameworks.The frameworks are almost the same.I used YII for two years in the project, and this year I used Laravel to make a project.The laravel framework is very popular.Yes, to be honest, I don't think it has any good, sometimes I feel that it is learning YII everywhere.Maybe after the framework is big, it will be the same.

/span>guest('shop/login'); } }); The auth rule in this filter determines whether the user has passed the login verification, and if it fails the verification, it will jump to the login page.

After understanding the routing rules in laravel, other things are almost the same as other frameworks.The frameworks are almost the same.I used YII for two years in the project, and this year I used Laravel to make a project.The laravel framework is very popular.Yes, to be honest, I don't think it has any good, sometimes I feel that it is learning YII everywhere.Maybe after the framework is big, it will be the same.

/span> } }) ; The auth rule in this filter determines whether the user passes the login authentication, and if it fails the authentication, it will jump to the login page.

After understanding the routing rules in laravel, other things are almost the same as other frameworks.The frameworks are almost the same.I used YII for two years in the project, and this year I used Laravel to make a project.The laravel framework is very popular.Yes, to be honest, I don't think it has any good, sometimes I feel that it is learning YII everywhere.Maybe after the framework is big, it will be the same.

/span> } }) ; The auth rule in this filter determines whether the user passes the login authentication, and if it fails the authentication, it will jump to the login page.

After understanding the routing rules in laravel, other things are almost the same as other frameworks.The frameworks are almost the same.I used YII for two years in the project, and this year I used Laravel to make a project.The laravel framework is very popular.Yes, to be honest, I don't think it has any good, sometimes I feel that it is learning YII everywhere.Maybe after the framework is big, it will be the same.

Tags

Technical otaku

Sought technology together

Related Topic

1 Comments

author

buy atorvastatin 80mg for sale & lt;a href="https://lipiws.top/"& gt;buy lipitor tablets& lt;/a& gt; order atorvastatin 80mg

Xmrfkz

2024-03-10

Leave a Reply

+