http://blog.csdn.net/yjj1s/article/details/5767810
Controller中的setFlash()、hasFlash()、getFlash()的使用。
PostController.php
class PostController extends CController
{
...
...
public function actionView()
{
$this->setFlash('commentSubmitted', '跳转后可以显示的消息');
$this->redirect(array('index'));
}
public function actionIndex()
{
$this->render('view');
}
}
view.php
<?php
if($this->hasFlash('commentSubmitted'))
{
echo $this->getFlash('commentSubmitted');//输出:跳转后可以显示的消息'
}
?>
所以这三个方法可以用来传递跳转后的消息,显示在弹出窗口之类的信息。