I'm working on an application (using Codeigniter framework) which needs an external php script to run separately. I want to access the Codeigniter object like this in that external file:
$CI =&get_instance();
the external file is placed in application/helpers/script.php
I followed This Solution but it didn't work for me.
also I tried this solution:-
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');
but it generates errors like "Constant" already defined.
How can I access the Codeigniter object in the external file?