我正在創建一個登錄窗體,在登錄窗體中,如果登錄失敗,我必須設置一個Flash消息。我已經使用下面的代碼來設置Flash消息。 在此稱爲executeLogin_process如何在symfony1.4中設置和顯示Flash消息
$this->getUser()->setFlash('error', 'Invalid User Name or Password', false);
$this->redirect('login/index');
,並顯示在indexSuccess.php的
<?php if ($sf_user->hasFlash('error')): ?>
<div class="flash_error"><?php echo $sf_user->getFlash('error') ?></div>
<?php endif ?>
消息通過使用該函數內的actions.class.php我不能夠顯示錯誤messages.i不知道我是否使用正確的代碼。任何人請幫助我...
謝謝scube。現在,它的工作... – Juice 2012-03-06 10:14:03
不客氣@LimiJerin – scube 2012-03-06 10:18:17