Create use native PHP session in codeigniter

View: 780    Dowload: 0   Comment: 0   Post by: hanhga   Category: Codeigniter   Fields: Other

You can add your own library to use native session in codeigniter.

A CodeIgniter library is simply a class that is loaded by the framework and made available for you to use in your Controller classes.  We are going to create a new library that starts a native PHP session and allows us to store and retrieve things from it.

Go to application/libraries

Create a file name Native_session.php

 
 
 

Using your new library in a controller.

 
 
 
load->library( 'Native_session' ); 
 
        //Read the data from session
        $username = $this->Native_session->get( 'your data' );
 
        //Update shopping cart session data
        $this->Native_session->set( 'cart', $cart );
    }
}
 
?>

You can now use your new Native session library in place of the CI-supplied session library.

Hope this article how to use native PHP session in codeigniter will help you.

 

 

 

 

 

 

Create use native PHP session in codeigniter

You can add your own library to use native session in codeigniter.

Posted on 08-01-2016 

Comment:

To comment you must be logged in members.

Files with category

 
File suggestion for you
File top downloads
Codetitle - library source code to share, download the file to the community
Copyright © 2018. All rights reserved. codetitle Develope by Vinagon .Ltd