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');//輸出:跳轉後可以顯示的消息'
}
?>
所以這三個方法可以用來傳遞跳轉後的消息,顯示在彈出窗口之類的信息。