In my admin session i can unset the session like below
In my controller I set the admin session like
On the logout controller what is the better way of unsetting the session in array I will be adding more in set session later.
PHP Code:
<?php
class Logout extends CI_Controller {
public function __construct() {
parent::__construct();
}
public function index() {
$admin_session_data = $this->session->userdata('admin');
unset($admin_session_data['is_logged']);
$this->session->unset_userdata('admin', $admin_session_data['is_logged']);
redirect(base_url('admin/common/login'));
}
}
In my controller I set the admin session like
PHP Code:
<?php
class Login extends CI_Controller {
public function __construct() {
parent::__construct();
}
public function index() {
$this->session->set_userdata('admin', array('is_logged' => TRUE));
echo anchor('admin/common/logout', 'Logout');
}
}
On the logout controller what is the better way of unsetting the session in array I will be adding more in set session later.