I created a Codeignier controller for testing, my controller using codeigniter session library:
Test.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Test extends CI_Controller {
function __construct()
{
parent::__construct();
$this->config->load('config');
$this->load->helper("url");
}
function index()
{
$newdata = array(
'username' => 'uname',
'email' => '[email protected]'
);
$this->session->set_userdata('testsession', $newdata);
redirect("https://mysite/index.php/test/getSession");
}
function getSession()
{
var_dump($this->session->userdata('testsession'));
}
}
Session library is loaded in Codeigniter's autoload.
$autoload['libraries'] = array('session');
This code was working good in my web server with Apache + PHP 7.1 and MySQL, but not working with xampp 7.1.1 in Windows. Codeignitor sessions not work in getSession function when using xampp.
My Codeigniter config file is default and I checked PHP's TimeZone.