Codeigniter, php5, Fatal error: Class 'Controller' not found

Fatal error: Class 'Controller' not found <local_path>\system\application\controllers\welcome.phpin line 3

<?php

class Welcome extends Controller {

    function __construct()
    {
        parent::Controller();   
    }

    function index()
    {
        $this->load->view('welcome_message');
    }
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */

I am new to php frameworks, I just extracted the CodeIgniter zip file and tried to launch the welcome.php controller in Aptana studio. (Php 5)

+3
source share
5 answers

the problem was that I was accessing this file directly (for example, saying that "treeface"), but using this route, it generated a page not found?

127.0.0.1:8000/test_ci/index.php/welcome

then I installed WAMP and used

local / test_ci / index.php / are welcome

and it works! Sorry for the inconvenience!

+2
source

. codeigniter 2.0 .

class Welcome extends CI_Controller {

    public function index()
    {
        $this->load->view('welcome_message');
    }
}
+4

CodeIgniter, :

class Hello extends CI_Controller
{
    var $name;
    var $color;
    function Hello()
    {
        parent :: __construct();
        $this->name = "Name";
        $this->color = "red";
    }
    function you()
    {
        $data["name"] = $this->name;
        $data["color"] = $this->color;
        $this->load->view("you_view", $data);
    }

}
+2

CI_Controller , CI_Controller

+1

, Codeigniter , '/'. BASEPATH index.php config.php, .

14-26 (?) index.php "" .

/*
|---------------------------------------------------------------
| SYSTEM FOLDER NAME
|---------------------------------------------------------------
|
| This variable must contain the name of your "system" folder.
| Include the path if the folder is not in the same  directory
| as this file.
|
| NO TRAILING SLASH!
|
*/
    $system_folder = "system";

, , CI .

0

Source: https://habr.com/ru/post/1762964/


All Articles