致命错误:在第8行的C:\ xampp \ htdocs \ CodeIgniter \ application \ controllers \ hello.php中调用未定义的方法CI_Controller :: CI_Controller()

Fatal error: Call to undefined method CI_Controller::CI_Controller() in C:\xampp\htdocs\CodeIgniter\application\controllers\hello.php on line 8

I am new to framework.I got the above error in CodeIgniter while doing a small application.Please help me..My code is given below

<?php 
class Hello extends CI_Controller {
var $name;
var $color;

function Hello()
{
parent::CI_Controller();
$this->name= 'Andi';
$this->color= 'red';
}

function you()
{
$data['name'] = $this->name;
$data['color'] = $this->color;
$this->load->views('you_view', $data);
}
}
?>

replace this function:

function Hello()
{
    parent::CI_Controller();
    $this->name     =   'Andi';
    $this->color    =   'red';
}

with:

public function __construct() {
    parent::__construct();
    $this->name     =   'Andi';
    $this->color    =   'red';
}

Note : In the latest version of Codeigniter you need to
use constructor instead of class name as constructor.

You used php 5 and in php 5 the way of writing constructor is __construct() where as php 4 allows developer to write constructor as class name that you used in your code.

So, Please write your constructor as...

function __construct()
{
    parent::CI_Controller();
    $this->name= 'Andi';
    $this->color= 'red';
}

I think your problem will resolve.