Unable to locate the model you have specified - CodeIgniter Issue

后端 未结 9 448
不知归路
不知归路 2021-01-14 03:55

I\'m getting an unable to locate model error.

$this->load->model(\'1/Gift_model\');

My model file name is gift_model.php

相关标签:
9条回答
  • 2021-01-14 04:36

    $this->load->model('1/Gift_model'); should be $this->load->model('1/gift_model');. Lowercase on this load argument and the php filename, uppercase on the class name within the file (you had two of three correct).

    0 讨论(0)
  • 2021-01-14 04:37

    http://www.codeigniter.com/userguide3/installation/upgrade_300.html

    Starting with CodeIgniter 3.0, all class filenames (libraries, drivers, controllers and models) must be named in a Ucfirst-like manner or in other words - they must start with a capital letter.

    Used to be the model files started with lower case, but they changed it.

    0 讨论(0)
  • 2021-01-14 04:40

    Ensure that the the model name is Gift_model and the class name is also Gift_model

    class Gift_model extends CI_Model
    {
    
    }
    

    but loading the class is '1/gift_model' NOT 'Gift_model'

    $this->load->model('1/gift_model');
    

    hope this was helpful

    0 讨论(0)
提交回复
热议问题