access codeigniter session values from external files

Tags: , ,



In my codeigniter project i have added KCK finder.

it needs some of session values which is controlled by codeigniter. how can i access CI session values from external files ?

Answer

<?php
    ob_start();
    include('index.php');
    ob_end_clean();
    $CI =& get_instance();
    $CI->load->library('session'); //if it's not autoloaded in your CI setup
    echo $CI->session->userdata('name');
?>


Source: stackoverflow