函数错误消息的参数太少

时间:2017-05-12 17:06:10

标签: php codeigniter

控制器:

public function deleteRoom($id){
     $this->Room->deleteRoom($id);
     $this->index();
    }

视图:

<a class="btn btn-danger" value="<?php echo $data['room_id']; ?>" href="<?= site_url('AdminController/deleteRoom'); ?>"><span class="glyphicon glyphicon-trash"></span></a>

它显示如下:消息:

  

函数AdminController :: deleteRoom()的参数太少,0传递   在第532行的C:\ xampp \ htdocs \ hrCI \ system \ core \ CodeIgniter.php中   正好是1预期

1 个答案:

答案 0 :(得分:1)

您没有在链接中传递ID。 尝试

<a class="btn btn-danger" value="<?php echo $data['room_id']; ?>" href="<?= site_url('AdminController/deleteRoom/'.$data['room_id']); ?>"><span class="glyphicon glyphicon-trash"></span></a>