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
12a00d49
Commit
12a00d49
authored
May 30, 2014
by
Klimov Paul
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:yiisoft/yii2
parents
5a8672a1
72f3a414
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
structure-controllers.md
docs/guide/structure-controllers.md
+18
-1
No files found.
docs/guide/structure-controllers.md
View file @
12a00d49
...
@@ -22,7 +22,7 @@ a controller ID and an action ID forms a *route* which takes the format of `Cont
...
@@ -22,7 +22,7 @@ a controller ID and an action ID forms a *route* which takes the format of `Cont
End users can address any controller action through the corresponding route. For example, the URL
End users can address any controller action through the corresponding route. For example, the URL
`http://hostname/index.php?r=site/index`
specifies that the request should be handled by the
`site`
controller
`http://hostname/index.php?r=site/index`
specifies that the request should be handled by the
`site`
controller
using its
`index`
action.
using its
`index`
action.
Please refer to the
[
Routing
](
runtime-routing.md
)
section for more details.
By default, controller and action IDs should contain lower-case alphanumeric characters and dashes only.
By default, controller and action IDs should contain lower-case alphanumeric characters and dashes only.
For example,
`site`
,
`index`
,
`post-comment`
and
`comment2`
are all valid controller/action IDs, while
For example,
`site`
,
`index`
,
`post-comment`
and
`comment2`
are all valid controller/action IDs, while
...
@@ -89,6 +89,22 @@ property, like the following in an [application configuration](structure-applica
...
@@ -89,6 +89,22 @@ property, like the following in an [application configuration](structure-applica
```
```
### Default Controller
Each application has a default controller specified via the
[
[yii\base\Application::defaultRoute
]
] property.
When a request does not specify a
[
route
](
#ids-routes
)
, the route specified by this property will be used.
For
[
[yii\web\Application|Web applications
]
], its value is
`'site'`
, while for
[
[yii\console\Application|console applications
]
],
it is
`help`
. Therefore, if a URL is
`http://hostname/index.php`
, it means the
`site`
controller will handle the request.
You may change the default controller with the following
[
application configuration
](
structure-applications.md#application-configurations
)
:
```
php
[
'defaultRoute'
=>
'main'
,
]
```
## Creating Actions
## Creating Actions
You can create actions in two ways: inline actions and standalone actions. An inline action is
You can create actions in two ways: inline actions and standalone actions. An inline action is
...
@@ -222,6 +238,7 @@ class SiteController extends Controller
...
@@ -222,6 +238,7 @@ class SiteController extends Controller
}
}
```
```
### Action Parameters
### Action Parameters
You can define named arguments for an action and these will be automatically populated from corresponding values from
You can define named arguments for an action and these will be automatically populated from corresponding values from
...
...
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