这是我的模型:
class Medecin_model extends CI_Model
{
public $fillable = array('nom','prenom','genre','adresse','date_naissance','specialiter','servise','grade','etablissement','type_personne');
public $id_medecin;
public $nom;
public $prenom;
public $genre;
public $adresse;
public $date_naissance;
public $specialiter;
public $service;
public $grade;
public $etablissement;
public $type_personne = Medecin;
public function insert($nom, $prenom, $genre, $adresse, $date_naissance, $specialiter, $service, $grade, $etablissement)
{
$this->nom=$nom;
$this->prenom=$prenom;
$this->genre=$genre;
$this->adresse=$adresse;
$this->date_naissance=$date_naissance;
$this->specialiter=$specialiter;
$this->service=$service;
$this->grade=$grade;
$this->etablissement=$etablissement;
// $this->db->insert('personne', $this);
}
这是我的控制器:
defined('BASEPATH') OR exit('No direct script access allowed');
class Medecin extends CI_Controller
{
public function index()
{
$this->load->view('header');
$this->load->view('ajout_medecin');
$this->load->view('footer');
}
public function ajout()
{
$this->load->model("Medecin_model");
$nom=$this->input->post('first-name');
$prenom=$this->input->post('last-name');
$genre=$this->input->post('genre');
$adresse=$this->input->post('adress');
$date_naissance=$this->input->post('birthday');
$specialiter=$this->input->post('speciality');
$service=$this->input->post('service');
$grade=$this->input->post('grade');
$etablissement=$this->input->post('establishment');
$doctor = new Medecin_model();
$doctor->insert($nom, $prenom, $genre, $adresse, $date_naissance, $specialiter, $service, $grade, $etablissement);
}
我有这个错误信息:
遇到 PHP 错误 严重性:通知消息:使用未定义的常量 Medecin - 假定为“Medecin” 文件名:core/Loader.php 行号:357 回溯:文件:C:\wamp64\www\CodeIgniter\application\controllers\Medecin。 php 行:23 函数:模型 文件:C:\wamp64\www\CodeIgniter\index.php 行:315 函数:require_once