Routing-7th episode

Source: Internet
Author: User

Function: The user accesses the specified page when the URL is matched to the executed controller or anonymous function! The default Laravel all routes exist in the app/http/routes.php file.

Schematic diagram:

The underlying routes are:

Route::get ($uri, $callback);

Route::p ost ($uri, $callback);

Route::p ut ($uri, $callback);

Route::p atch ($uri, $callback);

Route::d elete ($uri, $callback);

Route::options ($uri, $callback);

Route::match ([' Get ', ' post '], $callback);

Route::any (' foo ', $callback);

Note: Routes cannot contain-characters, and you can use _ instead if needed.

Optional Parameters:

Can be added by parameter? tag to implement, in which case you need to specify a default value of NULL or 0 for the variable in the callback function.

Note: When multiple parameters are used, the last one is optional and, if previously optional, may cause the subsequent directory to move forward. Causes an error.

Routing-7th episode

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.