Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
dee62967
Commit
dee62967
authored
Jan 26, 2015
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adjusted url guide to match change in #7025
parent
c49d04ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
runtime-routing.md
docs/guide/runtime-routing.md
+9
-10
No files found.
docs/guide/runtime-routing.md
View file @
dee62967
...
...
@@ -348,24 +348,23 @@ Let's use some examples to illustrate how named parameters work. Assume we have
When the rules are used to parse URLs:
-
`/index.php/posts`
is parsed into the route
`post/index`
using the
first
rule;
-
`/index.php/posts`
is parsed into the route
`post/index`
using the
second
rule;
-
`/index.php/posts/2014/php`
is parsed into the route
`post/index`
, the
`year`
parameter whose value is 2014
and the
`category`
parameter whose value is
`php`
using the
third
rule;
and the
`category`
parameter whose value is
`php`
using the
first
rule;
-
`/index.php/post/100`
is parsed into the route
`post/view`
and the
`id`
parameter whose value is 100 using
the
secon
d rule;
the
thir
d rule;
-
`/index.php/posts/php`
will cause a
[
[yii\web\NotFoundHttpException
]
] when
[
[yii\web\UrlManager::enableStrictParsing
]
]
is
true, because it matches none of the patterns. If
[
[yii\web\UrlManager::enableStrictParsing
]
] is false
(the
is
`true`
, because it matches none of the patterns. If
[
[yii\web\UrlManager::enableStrictParsing
]
] is
`false`
(the
default value), the path info part
`posts/php`
will be returned as the route.
And when the rules are used to create URLs:
-
`Url::to(['post/index'])`
creates
`/index.php/posts`
using the first rule;
-
`Url::to(['post/index', 'year' => 2014, 'category' => 'php'])`
creates
`/index.php/posts/2014/php`
using the
third rule;
-
`Url::to(['post/view', 'id' => 100])`
creates
`/index.php/post/100`
using the second rule;
-
`Url::to(['post/view', 'id' => 100, 'source' => 'ad'])`
creates
`/index.php/post/100?source=ad`
using the second rule.
-
`Url::to(['post/index'])`
creates
`/index.php/posts`
using the second rule;
-
`Url::to(['post/index', 'year' => 2014, 'category' => 'php'])`
creates
`/index.php/posts/2014/php`
using the first rule;
-
`Url::to(['post/view', 'id' => 100])`
creates
`/index.php/post/100`
using the third rule;
-
`Url::to(['post/view', 'id' => 100, 'source' => 'ad'])`
creates
`/index.php/post/100?source=ad`
using the third rule.
Because the
`source`
parameter is not specified in the rule, it is appended as a query parameter in the created URL.
-
`Url::to(['post/index', 'category' => 'php'])`
creates
`/index.php/post/index?category=php`
using none of rules.
-
`Url::to(['post/index', 'category' => 'php'])`
creates
`/index.php/post/index?category=php`
using none of
the
rules.
Note that since none of the rules applies, the URL is created by simply appending the route as the path info
and all parameters as the query string part.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment