[英]Unable to locate the model you have specified in CodeIgniter:
我正在嘗試在 codeigniter 中調用控制器中的模型,但這給我錯誤以定位您指定的模型。 在我的代碼中一切看起來都不錯,但我不明白為什么找不到模型這里是我的模型
<?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);
}
}
?>
在我的控制器中,我正在調用這個模型
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');
}
}
從我的角度來看,它的代碼看起來不錯,但可能是我遺漏了某個地方,任何人都可以幫助我解決這個問題。 我已經瀏覽了 stackoverflow 的所有答案,並檢查了他們所說的所有內容,我一直在關注,但我仍然無法解決它
謝謝
您的模型文件名必須是 ucfirst
Register_model.php
代替
$this->load->model('register_model');
和
$this->load->model('Register_model');
R 大寫。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.