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
13e833b7
Commit
13e833b7
authored
Jan 02, 2014
by
Mark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs added
parent
7ec8d0df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
url.md
docs/guide/url.md
+6
-0
No files found.
docs/guide/url.md
View file @
13e833b7
...
@@ -28,6 +28,8 @@ Some examples:
...
@@ -28,6 +28,8 @@ Some examples:
```
php
```
php
echo
\Yii
::
$app
->
urlManager
->
createUrl
(
'site/page'
,
[
'id'
=>
'about'
]);
echo
\Yii
::
$app
->
urlManager
->
createUrl
(
'site/page'
,
[
'id'
=>
'about'
]);
// /index.php/site/page/id/about/
// /index.php/site/page/id/about/
echo
\Yii
::
$app
->
urlManager
->
createUrl
(
'date-time/fast-forward'
,[
'id'
=>
105
])
// /index.php?r=date-time/fast-forward&id=105
echo
\Yii
::
$app
->
urlManager
->
createAbsoluteUrl
(
'blog/post/index'
);
echo
\Yii
::
$app
->
urlManager
->
createAbsoluteUrl
(
'blog/post/index'
);
// http://www.example.com/index.php/blog/post/index/
// http://www.example.com/index.php/blog/post/index/
```
```
...
@@ -35,7 +37,9 @@ echo \Yii::$app->urlManager->createAbsoluteUrl('blog/post/index');
...
@@ -35,7 +37,9 @@ echo \Yii::$app->urlManager->createAbsoluteUrl('blog/post/index');
The exact format of the outputted URL will depend upon how the URL manager is configured (which is the point). The above examples may also output:
The exact format of the outputted URL will depend upon how the URL manager is configured (which is the point). The above examples may also output:
*
`/site/page/id/about/`
*
`/site/page/id/about/`
*
`/index.php/hi-tech`
*
`/index.php?r=site/page&id=about`
*
`/index.php?r=site/page&id=about`
*
`/index.php/date-time/fast-forward?id=105`
*
`http://www.example.com/blog/post/index/`
*
`http://www.example.com/blog/post/index/`
*
`http://www.example.com/index.php?r=blog/post/index`
*
`http://www.example.com/index.php?r=blog/post/index`
...
@@ -46,6 +50,8 @@ echo $this->createUrl(''); // currently active route
...
@@ -46,6 +50,8 @@ echo $this->createUrl(''); // currently active route
echo
$this
->
createUrl
(
'view'
,
[
'id'
=>
'contact'
]);
// same controller, different action
echo
$this
->
createUrl
(
'view'
,
[
'id'
=>
'contact'
]);
// same controller, different action
echo
$this
->
createUrl
(
'post/index'
);
// same module, different controller and action
echo
$this
->
createUrl
(
'post/index'
);
// same module, different controller and action
echo
$this
->
createUrl
(
'/site/index'
);
// absolute route no matter what controller is making this call
echo
$this
->
createUrl
(
'/site/index'
);
// absolute route no matter what controller is making this call
echo
$this
->
createurl
(
'hi-tech'
);
// url for the case sensitive action `actionHiTech` of the current controller
echo
$this
->
createurl
(
'date-time/fast-forward'
,[
'id'
=>
105
]);
// url for action the case sensitive controller, `DateTimeController::actionFastForward`
```
```
> **Tip**: In order to generate URL with a hashtag, for example `/index.php?r=site/page&id=100#title`, you need to
> **Tip**: In order to generate URL with a hashtag, for example `/index.php?r=site/page&id=100#title`, you need to
...
...
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