Constructor error? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Constructor error? (/showthread.php?tid=51861) |
Constructor error? - El Forum - 05-21-2012 [eluser]Hamed[/eluser] I use one of website tutorial and now I get error on constructor: Fatal error: Call to undefined method CI_Controller::Controller() in C:\wamp\www\application\controllers\main.php on line 5 Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Constructor error? - El Forum - 05-21-2012 [eluser]CroNiX[/eluser] It must be outdated. We use php5's __construct() for constructors now. Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); But the main error you are seeing is because you used "parent::Controller();" instead of "parent::CI_Controller();", but that's moot if you use the new construct above. Please see the user guide for Controllers (this is mentioned at the bottom) |