I don't how to solve this error. While using the following controller and views in the CodeIgniter-3.0.0 Version and i change the baseurl also too http://localhost/code/
controllers: Hello.php
<?php
class Hello extends CI_Controller {
var $name;
var $color;
function Hello()
{
$this->name = 'Andi';
$this->color = 'red';
parent::CI_Controller();
}
function you()
{
$data['name'] = $this->name;
$data['color'] = $this->color;
$this->load->view('you_view',$data);
}
}
?>
View: you_view.php
Hello You!
<font color="<?=$color ?>"><?=$name?></font>
http://localhost/code/index.php/Hello/you
Got an error:
Fatal error: Call to undefined method CI_Controller::CI_Controller() in E:\phpprogram\code\application\controllers\hello.php on line 9
A PHP Error was encountered
Severity: Error
Message: Call to undefined method CI_Controller::CI_Controller()
Filename: controllers/hello.php
Line Number: 9
Backtrace:
You should extend CI_Controller
not Controller
in controllers/Hello.php