• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI4: not getting session data in another controller

#1
Dear Sir,

In Auth Controller, I have set session data and redirect to Homepage controller but I am unable to get session data in Homepage controller. Please find below code.

In Auth.php (Controller)

$mySess = session();
                    $mySess->set($data);         
//                    $this->session->set($data);

                    return redirect()->to(site_url("homepage"));


In Homepage (Controller)

<?php
namespace App\Controllers;
use CodeIgniter\Controller;


class Homepage extends BaseController
{

    public function index() {
        $mySess = session();
        $sessionArray = $mySess->get();
        print_r($sessionArray);
        exit();
    }
//--------------------------------------------------------------------
}



as a result I am getting blank page.

Please help.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.