Edited readme.md via GitHub

This commit is contained in:
Taylor Otwell 2011-07-14 11:11:57 -07:00
parent a9f7aacea9
commit ecdd559ace
1 changed files with 2 additions and 10 deletions

View File

@ -165,19 +165,11 @@ ### The Basics
<a name="routes-parameters"></a> <a name="routes-parameters"></a>
### Route URI Parameters ### Route URI Parameters
Laravel makes passing URI parameters to your route functions a breeze. Check out this route: Laravel makes passing URI parameters to your route functions a breeze using the **(:num)** and **(:any)** place-holders:
'PUT /user/(:num)' => function($id) {} 'PUT /user/(:num)' => function($id) {}
Notice the **(:num)** parameter in the URI? This tells Laravel to allow any numeric value in the second segment of the URI, as well as to pass the segment into the method. 'GET /user/(:any)/edit' => function($username) {}
We can also use the **(:any)** parameter to match the segment to any value:
'DELETE /product/(:any)' => function($name) {}
Of course, you are not limited to one parameter:
'GET /post/(:num)/(:num)' => function($month, $day) {}
Sometimes you may wish to make a parameter optional. You can do so by placing a **?** in parameter: Sometimes you may wish to make a parameter optional. You can do so by placing a **?** in parameter: