CI 묻고 답하기

제목 Fatal error: Call to undefined method CI_Model::ci_model() in 런 오류가 뜹니다
글쓴이 축구선수 작성시각 2011/03/18 18:08:20
댓글 : 4 추천 : 0 스크랩 : 0 조회수 : 22082   RSS
모델부분입니다
class Blog_model extends CI_Model {

var $title = '';
var $content = '';
var $date = '';

function Blog_model()
{
   
  parent::CI_Model();
}

컨트롤러부분입니다
$this->load->model('Blog_model',$config);
$data['query'] = $this->Blog_model->get_last_ten_entries();


--- 컨트롤러를 실행하면 Fatal error: Call to undefined method CI_Model::ci_model() in   런 오류가 뜹니다

원인좀 알려주세요 .. 첨시작해서 앞으로 잘 부탁드립니다 
 다음글 뷰에 모델이나 컨트롤러에 쓰이는 함수쓸 수 있나요?? (1)
 이전글 CI를 HTML5로 작업해 보신 분 있으신가요? (1)

댓글

변종원(웅파) / 2011/03/18 18:51:58 / 추천 0
매뉴얼을 다시 한번 잘 보시기 바랍니다. 모델부분.

규칙이 있습니다.

클래스명과 생성자는 첫자가 대문자 입니다. 
그리고 파일명은 소문자입니다.
(파일명을 대문자로 만드셨으면 위와 같은 에러가 안났겠죠. 파일명 대문자는 비추입니다.)

그리고 모델호출은 소문자입니다.

이건 매뉴얼에 나와있는 규칙입니다. 기본이구요. ^^


축구선수 / 2011/03/19 01:47:49 / 추천 0
답변주셔서 감사합니다 앞으로도 잘 부탁드립니다
답변주신 부분중에서 제가 틀린 부분은 모델호출시 소문자라고 하신부분인데 그 부분을 수정해도 마찬가지입니다. 모델페이지는  blog_model.php 입니다 

<?
class Blog extends CI_Controller {
function index()
{
$config['hostname'] = "localhost";
$config['username'] = "root";
$config['password'] = "xxxxxxx";
$config['database'] = "xxxxxxxxxxx";
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;

$this->load->model('blog_model',$config);
$data['query'] = $this->blog_model->get_last_ten_entries();
//$this->load->view('blog_view', $data);
}
}
?>
 
케이든 / 2011/03/19 08:39:58 / 추천 0
parent::__construct();
변종원(웅파) / 2011/03/19 17:42:32 / 추천 0
1.7X 구문과 2.0 구문을 혼합하여 사용하셨네요. ^^