PHP Laravel A few questions about routing control

Source: Internet
Author: User
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

    • Match
    • Any

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

    • Controller

    • Resource

      This is easy to use and automatically generates controllers directly,


      第一步 php artisan controller:make

Back to the question

    1. The invocation is not related to the method name, but it is best to follow the specification
    2. 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');
    3. Paging these are actually all a route, then add parameter control

    1. No, just expressing the meaning is showing welcome
    2. You need to specify in the routing. For example Route::get('showlist', '控制器类名称@方法'); , Xxx.com/shwolist points to methods in this class
    3. 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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.