Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shifted basic URI Routing examples down #2874

Merged
merged 1 commit into from
Apr 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions user_guide_src/source/incoming/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,27 @@ The following placeholders are available for you to use in your routes:
Examples
========

Here are a few basic routing examples::

$routes->add('journals', 'App\Blogs');
Here are a few basic routing examples.

A URL containing the word "journals" in the first segment will be remapped to the "App\Blogs" class,
and the default method, which is usually ``index()``::

$routes->add('blog/joe', 'Blogs::users/34');
$routes->add('journals', 'App\Blogs');

A URL containing the segments "blog/joe" will be remapped to the “\Blogs” class and the “users” method.
The ID will be set to “34”::

$routes->add('product/(:any)', 'Catalog::productLookup');
$routes->add('blog/joe', 'Blogs::users/34');

A URL with “product” as the first segment, and anything in the second will be remapped to the “\Catalog” class
and the “productLookup” method::

$routes->add('product/(:num)', 'Catalog::productLookupByID/$1';
$routes->add('product/(:any)', 'Catalog::productLookup');

A URL with “product” as the first segment, and a number in the second will be remapped to the “\Catalog” class
and the “productLookupByID” method passing in the match as a variable to the method.
and the “productLookupByID” method passing in the match as a variable to the method::

$routes->add('product/(:num)', 'Catalog::productLookupByID/$1';

.. important:: While the ``add()`` method is convenient, it is recommended to always use the HTTP-verb-based
routes, described below, as it is more secure. It will also provide a slight performance increase, since
Expand Down