[請益] CI 3.0, Unable to locate the model

作者: qm29213039 (崩啾)   2015-07-31 12:55:45
各位版大好
我在設定db連接的時候遇到下列的錯誤訊息
Unable to locate the model you have specified: Customermodel
照著google找到的訊息,大概都是說我大小寫設定好就可以解決了
可是照著做還是噴錯,想請益一下可能還有哪邊沒有設定好?
以下是程式碼:
controller/Login.php
<?PHP
if ( !defined('BASEPATH')) OR exit('No direct script access allowed');
class Login extends CI_Controller{
puclic funtion save(){
$this->load->model('customermodel');
$this->customermodel->insert($firstName, $lastName);
}
}
models/customermodel.php
<?PHP
if( !defined('BASEPATH')) OR exit('No direct scirpt access allowed');
class Customermodel extends CI_Model{
public funtion __construct()
{
parent::__construct();
}
function insert($firstName, $lastName){
$this->db->insert('customer_data',
Array("firstName" => $firstName,
"lastName" => $lastName
));
}
}
作者: itisjoe ( _(:3」∠)_)   2015-07-31 13:06:00
$this->load->model('customermodel'); 這行跟下一行customermodel 改成 Customermodel 試試看
作者: chenxiaowoo (灶咪A嘎B)   2015-07-31 13:39:00
基本上,就錯誤訊息,你的錯是在你的model,所以應該要改module的大小寫...
作者: Kenqr (function(){})()   2015-07-31 15:30:00
customermodel.php 改成 Customermodel.php
作者: chan15 (ChaN)   2015-08-01 19:36:00
ci 3 檔名要大寫另外直接把值弄成 array 丟進去不久不用弄那麼多次

Links booklink

Contact Us: admin [ a t ] ucptt.com