2017-12-18 107 views
0

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.型号

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:

回答

0

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

相关问题