无法找到指定的类:Session.php在Codeigniter中 [英] Unable to locate the specified class: Session.php in Codeigniter
本文介绍了无法找到指定的类:Session.php在Codeigniter中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
浏览器:
无法找到指定的类:Session.php
这是我的控制器:
<?php
class Chat extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('Chat_model');
}
public function index() {
$this->view_data['chat_id'] = 1;
$this->view_data['student_id'] = $this->session->userdata('student_id');
$this->view_data['page_content'] = 'chat';
$this->load->view('chat');
}
public function ajax_addChatMessage() {
$chat_id = $this->input->post('chat_id');
$student_id = $this->input->post('student_id');
$bericht = $this->input->post('chat_id', TRUE);
$this->Chat_model->addChatMessage($chat_id, $student_id, $bericht);
}
}
当我把我的模型注释在 parent :: __ construct(); // $ this-> load-> model('Chat_model');
错误消失了。
When I put my model in comment in the parent::__construct(); // $this->load->model('Chat_model');
the error is gone.
这是我的Chat_model:
This is my Chat_model:
<?php
class Chat_model extends CI_Controller {
public function Chat_model() {
parent::__construct();
}
public function addChatMessage($chat_id, $student_id, $bericht) {
$query = "INSERT INTO tbl_chatberichten (chat_id, student_id, bericht) VALUES (?,?,?)";
$this->db->query($query, array($chat_id, $student_id, $bericht));
}
}
推荐答案
class Chat_model extends CI_Controller
class Chat_model extends CI_Model
这篇关于无法找到指定的类:Session.php在Codeigniter中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文