-1
public function actionDelete($id)
{
if(Yii::app()->request->isPostRequest)
{
// we only allow deletion via POST request
try
{
$this->loadModel($id)->delete();
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
if(!isset($_GET['ajax']))
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
}
catch (Exception $e)
{
throw new CTestException('User in use, Delete Refrences.');
//Yii::app()->user->setFlash ('error', "User in use, Delete Refrences.");
}
}
else
{
throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
}
}
我想捕捉內部異常並顯示警報。它的setflash不工作,如果我拋出一個自定義的異常,它也警告錯誤500堆棧,我試圖處理的異常。yiiframework動作刪除不顯示setflash
你的'setflash'行被註釋掉了,所以它不會被執行。 –