Home > Backend Development > PHP Tutorial > Yii2 setFlash后redirect后,getFlash总是为空

Yii2 setFlash后redirect后,getFlash总是为空

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:24:42
Original
1214 people have browsed it

为啥呢?

Yii::$app->session->setFlash('danger', 'City Wide Curfew');
return Yii::$app->controller->redirect(['/default/index'], 307);
Copy after login
Copy after login

在 /default/index 中 echo Yii::$app->session->getFlash('danger') 总是为空?

回复内容:

为啥呢?

Yii::$app->session->setFlash('danger', 'City Wide Curfew');
return Yii::$app->controller->redirect(['/default/index'], 307);
Copy after login
Copy after login

在 /default/index 中 echo Yii::$app->session->getFlash('danger') 总是为空?

我的解决方法是:在Yii::$app->controller->redirect()后,Yii::$app->end()

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template