0

I want to load session in ci, Here is my class and its constructor

class User extends CI_Controller { function __construct() { $data = array('name'=>'Hussain','password'=>'rahimi'); $this->load->library('session'); } // __construct() } 

It gives me the following error:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: User::$load

Filename: controllers/user.php

Line Number: 5

Could someone help me? thanks in advance.

1 Answer 1

1

You are missing the parent`s constructor thus you are overriding it, replace your code with:

class User extends CI_Controller { function __construct() { parent::__construct(); //HERE $data = array('name'=>'Hussain','password'=>'rahimi'); $this->load->library('session'); } } 

Check the documentation: http://ellislab.com/codeigniter/user-guide/general/controllers.html

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.