Posts

Showing posts with the label session

Logout Function in PHP

Image
   This is for Codeigniter :- function logout ( ) { $user_data = $this ->session->all_userdata(); foreach ($user_data as $key => $value) { $this ->session->unset_userdata($key); } $this ->session->sess_destroy(); /////Here you have to write redirect url example : redirect("login");   }     This is for Core PHP:- function logout ( ) { session_start();  $_SESSION['email']=""; /// Here we are showing example to set empty to session key's value  session_destroy(); /////Here you have to write redirect url example : header("Location: login.php");    }