当我试图删除一个帖子时,我收到了这个错误:
Yii Error 400 The CSRF token could not be verified
我不知道究竟是什么导致了这种情况以及它可能与什么有关。这是我的删除操作:
public function actionDelete($id) {
if (Yii::app()->request->isPostRequest) {
// we only allow deletion via POST request
$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'));
}
else
throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
}
protected function afterDelete()
{
parent::afterDelete();
Image::model()->deleteAll('name='.$this->id);
Date::model()->deleteAll('tbl_show_id='.$this->id);
Press::model()->deleteAll('tbl_show_id='.$this->id);
}