/** * Deletes a particular user. * If deletion is successful, the browser will be redirected to the 'list' page. */ public function actionDelete() { if(Yii::app()->request->isPostRequest) { // we only allow deletion via POST request $this->loadUser()->delete(); $this->redirect(array('list')); } else throw new CHttpException(500,'Invalid request. Please do not repeat this request again.'); }
这是脚手架自动生成的代码
为什么要用Post请求来执行Delete?与安全有关?