问题
I know php well. But I am a very new learner of php framework . I am learning codeigniter 2.0.3. I am trying to develop a simple hello world application.
I have tried this code..
class Hello extends Controller{
function Hello(){
parent::Controller();
}
function you(){
$this->load->view("you_view");
}
}
But unfortunately I am receiving this error ...
Fatal error: Class 'Controller' not found in C:\wamp\www\CodeIgniter\application\controllers\hello_world.php on line 7
回答1:
Should be:
class Hello extends CI_Controller{
function __construct() {
parent::__construct();
/* use this only for setting default values,
loading helpers, models, ... */
}
function you() {
$this->load->view("you_view");
}
}
回答2:
Controller
should be CI_Controller
, like this:
class Hello extends CI_Controller{
回答3:
CI_Controller not Controller on
class Hello extends Controller{
becomes
class Hello extends CI_Controller{
回答4:
Here more information , examples and user Guide. Check this
Change Controller
to CI_Controller
in your code
来源:https://stackoverflow.com/questions/9946565/need-help-about-php-framework-codeigniter