Codeigniter Class Constructor

Codeigniter class constructor : Constructors are special functions which are called when a new object is created.

Syntax : Codeigniter class constructor

defined('BASEPATH') OR exit('No direct script access allowed');

class User extends CI_Controller {

       public function __construct()
            // $this->load->helper('url');
            // More code goes here...


Note parent::__construct(); is required to override the parent class’s constructor.


Add Comment

📖 Read More