无法找到指定的类:Session.php在Codeigniter中

编程入门 行业动态 更新时间:2024-10-04 05:28:57
本文介绍了无法找到指定的类: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中

本文发布于:2023-11-02 06:41:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551647.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Session   php   Codeigniter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!