[请益] 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