尚未捕获的ArgumentCountError:参数很少,无法在codeigniter中运行

时间:2019-05-14 03:13:10

标签: php mysql codeigniter-3

我想在Codeigniter中将数据从模型传递到控制器,并得到此错误:

  

遇到未捕获的异常类型:ArgumentCountError   消息:函数Debitur :: get_data_sms()的参数太少,0   通过   C:\ xampp \ htdocs \ sms_gateway_2 \ application \ controllers \ User.php在线   119,正好是3个

     

文件名:C:\ xampp \ htdocs \ sms_gateway_2 \ application \ models \ Debitur.php

     

行号:9

     

回溯:

     

文件:C:\ xampp \ htdocs \ sms_gateway_2 \ application \ controllers \ User.php   行:119功能:get_data_sms

     

文件:C:\ xampp \ htdocs \ sms_gateway_2 \ index.php行:315功能:   require_once

这是我在模型(Debitur.php)中的功能:

    public function get_data_sms($nama_deb, $no_hp, $tunggakan)
      {  

    $array = array('nama_deb' => $nama_deb, 'no_hp' => $no_hp, 'tunggakan' => $tunggakan);
    $query = $this->db->getwhere('sms_debitur', $array);

    return $query->result();
      }

这是我在控制器(User.php)中的功能:

    public function sending_sms(){

    $this->load->library('bulkSms');

    $data= $this->debitur->get_data_sms();

    if ($data){
            $bulkSms = new bulkSms('***');

            $device = 111;
            $options = [];

            $number = $no_hp;
            $message = "To ".$nama_deb." payment ".$tunggakan."..";

            $result = $bulkSms->sendMessageToNumber($number, $message, $device, $options);

            if (count($result['response']['result']['success']) > 0) {
            $this->session->set_flashdata('message', '<div class="alert alert-success">Berhasil mengirim sms</div>');
            } else {
            $this->session->set_flashdata('message', '<div class="alert alert-danger">Gagal mengirim sms</div>');
            }

            redirect('user/send_sms', 'refresh');

    }
}

0 个答案:

没有答案