在编码器上扩展核心控制器


extending core controller on codeigniter

我已经把这个控制器放在application/core上,名为MY_base.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Base_Controller extends CI_Controller {
public function __construct(){
        parent::__construct();
}
function set_spaces($post_array, $primary_key){
      $post_array['nombre']=str_replace(" ", "_", $post_array['nombre']);
      return $post_array;
}
}
?>

和这个控制器在controllers文件夹

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Clase extends Base_Controller {
 function __construct(){
   parent::__construct();
   $this->load->library('grocery_CRUD');
 }
 function index(){
  if($this->session->userdata('logged_in')){
   $this->grocery_crud->set_table('clase');
   $this->grocery_crud->set_subject('Clase');
   $this->grocery_crud->required_fields('nombre');
   $this->grocery_crud->unset_columns('id');
   $this->grocery_crud->unset_print();
   $this->grocery_crud->unset_export();
   $this->grocery_crud->unset_add();
   $this->grocery_crud->callback_before_update(array($this,'set_spaces'));
  //$this->grocery_crud->set_theme('datatables');
   $output = $this->grocery_crud->render();
  //$this->load->view('header', $data);
   $this->load->view('header2.php',$output);
   $this->load->view('clase_view', $output);
 }
 else{
  redirect('login', 'refresh');
}
}
}
?>

我想我已经正确地遵循了文档的说明,但是我得到了这个错误

Fatal error: Class 'Base_Controller' not found in C:'xampp'htdocs'esi3d'application'controllers'clase.php on line 3

它看起来是在寻找控制器上的base_controller文件夹而不是在核心文件夹

将MY_base.php也放在controllers文件夹