Controller error in CodeIgniter and Doctrine tutorial

£可爱£侵袭症+ 提交于 2020-01-05 08:41:50

问题


I would like to connect to function world() but I get an error. Do you know what I have to do? There are my first steps with CodeIgniter - I'm doing this tutorial.

Urls I've tried:

  • localhost/nauka/index.php/hello/world
  • localhost/nauka/index.php/Hello/world

Error:

Fatal error: Class 'Controller' not found in C:\wamp\www\nauka\application\controllers\hello.php on line 5

Screenshot:


回答1:


Your controller should extend CI_Controller

class Hello extends CI_Controller {

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

This may be different for older versions but you shouldn't be using versions that don't extend CI_Controller anyhow.

Also, you need the parent::__construct in there




回答2:


class Hello extends CI_Controller



来源:https://stackoverflow.com/questions/14656932/controller-error-in-codeigniter-and-doctrine-tutorial

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!