Welcome Guest, Not a member yet? Register   Sign In
Accessing CI session data outside of CI
#1

I have a folder in my
Code:
Codeigniter4/public/oldproject

where i have created a test.php so that I can access it using
PHP Code:
myci4site.com/oldproject/test.php 

In test.php

PHP Code:
$path realpath(dirname(dirname(dirname(__FILE__))).'/writable/session');
//ini_set('session.save_path',$path);
session_save_path ($path);
session_id$_COOKIE['ci4session'] );
session_start();

print_r($_SESSION); 
but it prints an empty array.

There is session data in the session which I can print in my Home controller e.g. myci4site.com/home/test which just contains

PHP Code:
$sess session()->get();
echo 
'<pre>';print_r($sess); 

What else I need to do to be able to get session data in my test.php?

I need to access this data for maintaining old code for the time being.
Thanks.
Reply


Messages In This Thread
Accessing CI session data outside of CI - by happyape - 09-28-2018, 09:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB