type error- call to undefined method in code igniter version3

时间:2017-12-18 05:23:23

标签: codeigniter-3

1.Controller

class Client extends CI_Controller {

private $controller = '';
private $data = array();

function __construct() {
    parent::__construct();
    $this->load->model('Client_model');
    $this->load->library('email');
    $this->load->library('session');
    $this->data['is_queue_page'] = true;
    $this->controller = strtolower(__CLASS__);
    $this->base_layout = 'layouts/main_content';
    $this->is_logged();
}

function cliedit( $id ) {
        //$this->data['business'] = $this->treatment_model->get_business();
        $this->data['cliedit'] = $this->Client_model->get_cedit($id);
        $this->data['main_content'] = $this->controller . '/cedit';
        $this->load->view('layouts/main_content', $this->data); }

2.model

function get_cedit($id) {
    $this->db->select('*');
    $this->db->from('client');
    $this->db->where('client_id', $id);
    return $this->db->get()->r
}

3.error

Fatal error: Call to undefined method Client_model::get_cedit() in C:\xampp\htdocs\pms\application\controllers\Client.php on line 113 A PHP Error was encountered

Severity: Error Message: Call to undefined method Client_model::get_cedit() Filename: controllers/Client.php Line Number: 113 Backtrace:

1 个答案:

答案 0 :(得分:0)

请检查所有的paranthesis是否正确关闭,即使它没有关闭也可能导致类似的错误。