0
点赞
收藏
分享

微信扫一扫

Declaration of Admin\Controller\GameController::delete() should be compatible with。。

JakietYu 2022-05-09 阅读 6


NOTIC: [2048] Declaration of Admin\Controller\GameController::delete() should be compatible with Admin\Controller\AdminController::delete($model, $where = Array, $msg = Array) /home/wwwroot/122/Application/Admin/Controller/GameController.class.php 第 16 行.


出现这个错误是因为我写的方法和继承的父类有所冲突,解决办法就是改下子类 的名称或者和父类的实现方法格式统一。

项目详情:

class GameController extends AdminController

父类控制器:AdminController

protected function delete ( $model , $where = array() , $msg = array( 'success'=>'删除成功!', 'error'=>'删除失败!')) {

$data['status'] = -1;

//$data['update_time'] = NOW_TIME;

$this->editRow( $model , $data, $where, $msg);

}


子类控制器:GameController

public function delete(){

$id = I('get.id');

if(empty($id)){

$this->error('参数不能为空!');

}else{

$data['status'] = 0;

$data['open'] = 0;

$update = M('Game') -> where('id='.$id)->save($data);

if($update){

$this->success('删除成功!',U('index'));

}else{

$this->error('删除失败!',U('index'));

}

}

}


两个都是删除,但是写的不太一样,或者当时不知道咋想的。。。


__________________________________________________________________________________

若有帮助到您,欢迎捐赠支持,您的支持是对我坚持最好的肯定(*^_^*)

你要保守你心,胜过保守一切。

作者:刘俊涛的博客​​




举报

相关推荐

0 条评论