コードの何が問題なのかわかりません.......モデルのロード中にエラーが発生しました.......助けてください........私のコントローラー
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Exams extends CI_Controller {
public function index(){
$ob = new exam_class();
$ob->set_exam(0,'Html exam','1','20');
$ob->create_exam();
echo 'success';
}
}
class exam_class{
private $id;
private $title;
private $catagory;
private $timeLength;
function set_exam($id,$title,$catagory,$timeLength){
$this->id = $id;
$this->title = $title;
$this->catagory = $catagory;
$this->timeLength = $timeLength;
}
function create_exam(){
$this->load->model('examModel');
$this->examModel->create_exams($title,$catagory,$timeLength);
}
}
モデル
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ExamModel extends CI_Model {
public function create_exams($title,$catagory,$timeLength){
$data = array(
'title' => $title ,
'catagory' => $catagory ,
'timeLength' => $timeLength
);
$this->db->insert('exams', $data);
}
}
error PHP エラーが発生しました
重大度: 通知
メッセージ: 未定義のプロパティ: Exam_class::$load
ファイル名: controllers/exams.php
ライン番号: 26
致命的なエラー: 26 行目の C:\xampp\htdocs\exam\application\controllers\exams.php の非オブジェクトに対するメンバー関数 model() の呼び出し