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
5a52503d
Commit
5a52503d
authored
Nov 20, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6137 from cdvrooman/patch-8
Update runtime-requests.md
parents
d3c3d682
1c462f22
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
runtime-requests.md
docs/guide/runtime-requests.md
+3
-3
No files found.
docs/guide/runtime-requests.md
View file @
5a52503d
...
@@ -35,7 +35,7 @@ $name = $request->post('name', '');
...
@@ -35,7 +35,7 @@ $name = $request->post('name', '');
```
```
> Info: Instead of directly accessing `$_GET` and `$_POST` to retrieve the request parameters, it is recommended
> Info: Instead of directly accessing `$_GET` and `$_POST` to retrieve the request parameters, it is recommended
that you get them via the
`request`
component
like
shown above. This will make writing tests easier because
that you get them via the
`request`
component
as
shown above. This will make writing tests easier because
you can create a mock request component with faked request data.
you can create a mock request component with faked request data.
When implementing
[
RESTful APIs
](
rest-quick-start.md
)
, you often need to retrieve parameters that are submitted
When implementing
[
RESTful APIs
](
rest-quick-start.md
)
, you often need to retrieve parameters that are submitted
...
@@ -108,13 +108,13 @@ $accept = $headers->get('Accept');
...
@@ -108,13 +108,13 @@ $accept = $headers->get('Accept');
if
(
$headers
->
has
(
'User-Agent'
))
{
// there is User-Agent header }
if
(
$headers
->
has
(
'User-Agent'
))
{
// there is User-Agent header }
```
```
The
`request`
component also provides support for quickly accessing some commonly used headers, including
The
`request`
component also provides support for quickly accessing some commonly used headers, including
:
*
[
[yii\web\Request::userAgent|userAgent
]
]: returns the value of the
`User-Agent`
header.
*
[
[yii\web\Request::userAgent|userAgent
]
]: returns the value of the
`User-Agent`
header.
*
[
[yii\web\Request::contentType|contentType
]
]: returns the value of the
`Content-Type`
header which indicates
*
[
[yii\web\Request::contentType|contentType
]
]: returns the value of the
`Content-Type`
header which indicates
the MIME type of the data in the request body.
the MIME type of the data in the request body.
*
[
[yii\web\Request::acceptableContentTypes|acceptableContentTypes
]
]: returns the content MIME types acceptable by users.
*
[
[yii\web\Request::acceptableContentTypes|acceptableContentTypes
]
]: returns the content MIME types acceptable by users.
The returned types
ordered by the
quality score. Types with the highest scores will be returned first.
The returned types
are ordered by their
quality score. Types with the highest scores will be returned first.
*
[
[yii\web\Request::acceptableLanguages|acceptableLanguages
]
]: returns the languages acceptable by users.
*
[
[yii\web\Request::acceptableLanguages|acceptableLanguages
]
]: returns the languages acceptable by users.
The returned languages are ordered by their preference level. The first element represents the most preferred language.
The returned languages are ordered by their preference level. The first element represents the most preferred language.
...
...
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