Question Detail

When i'm try to check session condition it shows me a error  Unable to locate the specified class: Session.php 

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Logout extends CI_Controller {
public function __construct(){
 parent::__construct();
 $this->load->library('session');
}
public function Check()
{
if($this->session->userdata('q') > 60 ){

$this->session->set_userdata("q", time());
}
else{
$this->session->unset_userdata('q');
//redirect(base_url());
}
}
} ?>


Thread Reply

Vamshi Goud

- 1 years ago

autoload.php
$autoload['drivers'] = array('session');

hooks.php
$hook['post_controller_constructor'] = array(

post controller constructor 
$this->session->set_userdata(..

another controller (Home.php)
print_r($this->session->userdata());

Anonymous

- 2 months ago

I think you have missed to add session class in the config folder autoload.php

When we miss session class only then we got error : Unable to locate the specific class session.php

It will add all methods of session class

Add changes into your library configurations in application/config/autoload.php file

$autoload['libraries'] = array('session');

and in

application/config/config.php

set the encryption key(any key u like) $config['encryption_key'] = 'HKKVDUI853VJKXFM';

If you still get same error then copy

System/library/Session/Session.php

to

System/library/ folder,

then it should work