@jasen
To log out of your Codeigniter application, you can use the logout()
function provided by the Session library. Here's an example of how you can use it:
1 2 3 4 5 6 7 8 |
// Load the session library $this->load->library('session'); // Destroy the session data $this->session->sess_destroy(); // Redirect to the login page redirect('login'); |
This will destroy the session data and redirect the user back to the login page. You can adjust the redirect URL to point to any page you want.
Alternatively, you can use the unset_userdata()
function to remove specific session data:
1
|
$this->session->unset_userdata('username'); |
This will remove the username
session variable. You can specify any other session variable you want to remove in the same way.
I hope this helps! Let me know if you have any other questions.