• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

类型无错误调用未定义的方法

codeigniter-3 来源:Annu Antony 7次浏览

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:

===========解决方案如下:

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


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)