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
76154b97
Commit
76154b97
authored
Sep 23, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #901: Added $delete parameter to Session::getFlash().
parent
c05477b1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
Session.php
framework/yii/web/Session.php
+12
-2
No files found.
framework/yii/web/Session.php
View file @
76154b97
...
@@ -582,12 +582,22 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co
...
@@ -582,12 +582,22 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co
* A flash message is available only in the current request and the next request.
* A flash message is available only in the current request and the next request.
* @param string $key the key identifying the flash message
* @param string $key the key identifying the flash message
* @param mixed $defaultValue value to be returned if the flash message does not exist.
* @param mixed $defaultValue value to be returned if the flash message does not exist.
* @param boolean $delete whether to delete this flash message right after this method is called.
* If false, the flash message will be automatically deleted after the next request.
* @return mixed the flash message
* @return mixed the flash message
*/
*/
public
function
getFlash
(
$key
,
$defaultValue
=
null
)
public
function
getFlash
(
$key
,
$defaultValue
=
null
,
$delete
=
false
)
{
{
$counters
=
$this
->
get
(
$this
->
flashVar
,
array
());
$counters
=
$this
->
get
(
$this
->
flashVar
,
array
());
return
isset
(
$counters
[
$key
])
?
$this
->
get
(
$key
,
$defaultValue
)
:
$defaultValue
;
if
(
isset
(
$counters
[
$key
]))
{
$value
=
$this
->
get
(
$key
,
$defaultValue
);
if
(
$delete
)
{
$this
->
removeFlash
(
$key
);
}
return
$value
;
}
else
{
return
$defaultValue
;
}
}
}
/**
/**
...
...
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