简体   繁体   中英

Unable to locate the model you have specified in CodeIgniter:

I am trying to call a model in controller in codeigniter but that give me error that to locate the model you have specified. Everything looks ok in my code but I did not get why it is not finding the model here is my model

<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Register_model extends CI_Model {

    function __construct()

    {

        parent::__construct();

        $this->load->database("chandqki_mmusic");

    }

    public function insert_users_to_db($data)
    {

        return $this->db->insert('music_user_register', $data);

    }
}
?>

and in my controller I am calling this model

class Home extends CI_Controller{

     public function __construct()
     {
       parent::__construct();
     }

    public function index()

    {

        $this->load->helper('url');
        $this->load->view('Home_view');
        $this->load->model('register_model');

    }
}

From my side its code is looking ok but May be I am missing somewhere can anybody help me regarding this. I have go through all the answers of stackoverflow and check all the whatever they say everything is I am following like that but still I am unable to solve it

Thanks

您的模型文件名必须是 ucfirst

Register_model.php

Replace

$this->load->model('register_model');

with

$this->load->model('Register_model');

R in register in caps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM