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
8b3b6b4e
Commit
8b3b6b4e
authored
Oct 02, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5312 from nikbas/fix-responses-documentation
[ci skip] Fixed minor typos and grammar errors
parents
2cc17a77
3d529206
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
runtime-responses.md
docs/guide/runtime-responses.md
+6
-6
No files found.
docs/guide/runtime-responses.md
View file @
8b3b6b4e
...
...
@@ -85,20 +85,20 @@ If you already have a formatted body string, you may assign it to the [[yii\web\
of the response. For example,
```
php
Yii
::
$app
->
re
quest
->
content
=
'hello world!'
;
Yii
::
$app
->
re
sponse
->
content
=
'hello world!'
;
```
If you
data needs to be formatted before sending
to end users, you should set both of the
If you
r data needs to be formatted before sending it
to end users, you should set both of the
[
[yii\web\Response::format|format
]
] and
[
[yii\web\Response::data|data
]
] properties. The
[
[yii\web\Response::format|format
]
]
property specifies in which format
should the
[
[yii\web\Response::data|data
]
] be formatted as
. For example,
property specifies in which format
the
[
[yii\web\Response::data|data
]
] should be formatted
. For example,
```
php
$response
=
Yii
::
$app
->
re
quest
;
$response
=
Yii
::
$app
->
re
sponse
;
$response
->
format
=
\yii\web\Response
::
FORMAT_JSON
;
$response
->
data
=
[
'message'
=>
'hello world'
];
```
Yii supports the following formats out of box, each implemented by a
[
[yii\web\ResponseFormatterInterface|formatter
]
] class.
Yii supports the following formats out of
the
box, each implemented by a
[
[yii\web\ResponseFormatterInterface|formatter
]
] class.
You can customize these formatters or add new ones by configuring the
[
[yii\web\Response::formatters
]
] property.
*
[
[yii\web\Response::FORMAT_HTML|HTML
]
]: implemented by
[
[yii\web\HtmlResponseFormatter
]
].
...
...
@@ -135,7 +135,7 @@ public function actionInfo()
```
As aforementioned, besides using the default
`response`
application component, you can also create your own
response objects and send them to end users. You can do so by returning such
an
object in an action method, like the following,
response objects and send them to end users. You can do so by returning such object in an action method, like the following,
```
php
public
function
actionInfo
()
...
...
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