I downloaded the latest version of Laravel, and then I'm going to use him to do a Web site navigation program.
I want to do it from the admin background, so that I can add the test content, I read the document, but I feel a lot of places have not said.
1) The method inside the controller public Function Showwelcome () {}, is not added to the show prefix can be accessed, if not add the show prefix is not accessible?
2) If I have a controller, file address:/app/controllers/infocontrollers.php inside a method public function Showlist () {}, his access address default is how much ah.
What is the default when rewriting is turned on and not turned on? Is it/info/showlist or/info/list/?
3) about the route must be bound. I asked a person, and he told me that every URL had to write a routing rule.
My question is that so laravel there is no default URL. How this default URL is generated:
If every URL to write a route, a site is sure a lot of different sites, such as paging, such as admin background operations Delete, it is not very cumbersome, every URL to write a route. Laravel don't have a default URL format?
Reply content:
I downloaded the latest version of Laravel, and then I'm going to use him to do a Web site navigation program.
I want to do it from the admin background, so that I can add the test content, I read the document, but I feel a lot of places have not said.
1) The method inside the controller public Function Showwelcome () {}, is not added to the show prefix can be accessed, if not add the show prefix is not accessible?
2) If I have a controller, file address:/app/controllers/infocontrollers.php inside a method public function Showlist () {}, his access address default is how much ah.
What is the default when rewriting is turned on and not turned on? Is it/info/showlist or/info/list/?
3) about the route must be bound. I asked a person, and he told me that every URL had to write a routing rule.
My question is that so laravel there is no default URL. How this default URL is generated:
If every URL to write a route, a site is sure a lot of different sites, such as paging, such as admin background operations Delete, it is not very cumbersome, every URL to write a route. Laravel don't have a default URL format?
Routes in Laravel are easily visible in 2
Regular routes
Regular routing, or Basic routing, supports HTTP Method or regular matching, and is custom
Route::get('xxx',xxx); Route::get('xxx/*',xxx); Route::post('xxx',function(){ xxxx }); Route::get('/', 'DashBoardController@index');
There are currently support for various HTTP method
- Get
- Post
- Put
- Patch
- Options
- Delete
Matching routes
Custom
Route::get('user', 'UserController@index');
This is where you call the index method in Usercontroller when you visit Xxx/user.
RESTful routing
RESTful routing is divided into 2 kinds, the first kind of useless no comment, the second kind of use is very comfortable
Back to the question
- The invocation is not related to the method name, but it is best to follow the specification
- It depends on the definition in your router,
For example, if you define this, you are visiting http://domain/test.Route::get('test', 'InfoControllers@showList');
- Paging these are actually all a route, then add parameter control
- No, just expressing the meaning is showing welcome
- You need to specify in the routing. For example
Route::get('showlist', '控制器类名称@方法');
, Xxx.com/shwolist points to methods in this class
- Without the default route, you take a closer look at the routing chapter and all the questions are solved.
You can combine the official documents and look at this article: HTTP://LARAVELBASE.COM/COLLECTIONS/1/36
@trigged
The following has been wrongly written:
First step PHP artisan controller:make usercontroller
Correct modification:
First step PHP artisan Make:controller usercontroller