在警予的网站我创造我与网址的网页http://localhost/administrator/restaurant/list
,显示的餐馆以表格的形式与删除按钮沿列表。 删除按钮指向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
和示出一个错误。 是不是有什么毛病我实现了重定向功能的方式吗?