在套接字IO中找不到类“CI_Controller”

时间:2017-08-23 09:58:41

标签: php node.js codeigniter express socket.io

如何解决此错误? 目录 -应用  -controller   -Rest.php -app.js

app.js

'use strict';

var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var phpExpress = require('php-express')({

  // assumes php is in your PATH
  binPath: 'php'
});
var path = require('path');

app.set('port',process.env.PORT || 8000);
app.set('views','application/controllers');
app.engine('php', phpExpress.engine);
app.set('view engine', 'php');

app.use(require('express').static(path.join(__dirname, 'public')));
app.use(require('express').static(path.join(__dirname, 'bower_components')));

app.get('/', function(req, res) {
  return res.render('rest');
});

io.on('connection', function(socket) {
  socket.on('chat:pesan', function(pesan) {
    io.emit('chat:pesan', pesan);
  });
});

http.listen(app.get('port'), function() {
  console.log('Server jalan di port ' + app.get('port') + __dirname);
});

Rest.php

<?php
class Rest extends CI_Controller{
    public function __construct(){
        parent:: __construct();   
        date_default_timezone_set("Asia/Jakarta");
        $this->load->helper('url');
        $this->load->model('rest_model');
        $this->load->model('log_model');
        $this->load->library('parsing_data');
    }
}
?>

结果

  

致命错误:找不到类'CI_Controller'   第2行的C:\ xampp \ htdocs \ iap \ tugas1 \ application \ controllers \ rest.php

0 个答案:

没有答案