私が作成しているyiiサイトにはhttp://localhost/administrator/restaurant/list
、削除ボタンとともに表形式でレストランのリストを表示するURLのページがあります。削除ボタンはを指しますhttp://localhost/administrator/restaurant/delete/<id>
。
私のactionDelete
コントローラーのは次のとおりです:
public function actionDelete(){
$model = Restaurants::model()->findByAttributes(
array(
'id'=>$_GET['id'],
'clientId'=>Yii::app()->user->clientId
));
$model->delete();
Yii::app()->user->setFlash('success',Yii::t('error','Restaurant has been deleted successfully'));
$this->redirect('restaurant/list',true);
}
http://localhost/administrator/restaurant/list
ただし、削除ボタンをクリックすると、行はデータベースから正常に削除されますが、ページにリダイレクトする代わりに、にリダイレクトしhttp://localhost/administrator/restaurant/delete/restaurant/list
てエラーが表示されます。リダイレクト機能の実装方法に問題がありますか?