Codeigniter:使用未定义常量
Codeigniter :Use of undefined constant
这是我的模特:
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);
}
我收到了这条错误消息:
A PHP Error was encountered Severity: Notice Message: Use of undefined constant Medecin - assumed 'Medecin' Filename:
core/Loader.php Line Number: 357 Backtrace: File:
C:\wamp64\www\CodeIgniter\application\controllers\Medecin.php Line: 23
Function: model File: C:\wamp64\www\CodeIgniter\index.php Line: 315
Function: require_once
缺少 ''
Medecin
替换
public $type_personne = Medecin;
有了这个
public $type_personne = 'Medecin';
这是我的模特:
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);
}
我收到了这条错误消息:
A PHP Error was encountered Severity: Notice Message: Use of undefined constant Medecin - assumed 'Medecin' Filename: core/Loader.php Line Number: 357 Backtrace: File: C:\wamp64\www\CodeIgniter\application\controllers\Medecin.php Line: 23 Function: model File: C:\wamp64\www\CodeIgniter\index.php Line: 315 Function: require_once
缺少 ''
Medecin
替换
public $type_personne = Medecin;
有了这个
public $type_personne = 'Medecin';