How to understand Laravel's thoughts?
1)更新太快,疲于追赶
Laravel 4.x developed programs to upgrade to 5.x, seemingly all the fuss?
2)让人后怕的Route
Why doesn't there be a fixed rule? Do you have to write a route for every URL, and then write one line at a A-row?
Route::get('/', function () { return 'Hello World';});Route::post('foo/bar', function () { return 'Hello World';});Route::put('foo/bar', function () { //});Route::delete('foo/bar', function () { //});
Where does it have to be written? If so, how to open independently? Are all written in one file?
No unified URL routing like Codeigiter, Yii, is difficult to understand
Reply content:
How to understand Laravel's thoughts?
1)更新太快,疲于追赶
Laravel 4.x developed programs to upgrade to 5.x, seemingly all the fuss?
2)让人后怕的Route
Why doesn't there be a fixed rule? Do you have to write a route for every URL, and then write one line at a A-row?
Route::get('/', function () { return 'Hello World';});Route::post('foo/bar', function () { return 'Hello World';});Route::put('foo/bar', function () { //});Route::delete('foo/bar', function () { //});
Where does it have to be written? If so, how to open independently? Are all written in one file?
No unified URL routing like Codeigiter, Yii, is difficult to understand
How to understand Laravel's thoughts?
This topic is too long to unfold, in short, that mathematics, for example, Laravel gives you
数字1-9 + - * /
As for you to count 5, you are using any of the following methods depending on your own choice
5=2+35=1*55=6-15=10/2
Instead of telling you, you can only be
5=2+3
Only through + to achieve some purpose, so understand laravel need to understand the first to provide what, but not to know one, and then to rely on this way to solve all the problems
A route that scared people
First we want to see what the route has to offer, the following are online articles, I will not write
Laravel Learning Notes-routing (Basic)
You just stay at this stage.
Suggest to look first
Laravel Learning Notes-routing (Routing and Controller)
And then looking at
Laravel Learning Notes-routing (middleware and routing groups)
Still not satisfied
Laravel 5.0-route Annotations (routing note) (frame core not integrated, requires additional expansion laravel-annotations)
Version 5.0 before the update is a little bit faster, the latest release of 5.1 is the first LTS version, committed to 3 years of support cycle; routing can be used Route::controller ().
php
Route::any('foo/bar', IndexController@index); Route::controller('foo/bar', 'IndexController');
For the main question of each URL to write a route to this, the main question is not to read the document well
I usually write this in the route.
Route::controller('/','HomeController');
And then define it in the controller.
or directly with Restfulapi.
It is also recommended to start from 4. X start learning after all the various documents, the answer will be a little more ~
After familiarity you can start learning 5.0