Skip to content

Instantly share code, notes, and snippets.

@sunkibaek
Last active December 30, 2015 09:39
Show Gist options
  • Save sunkibaek/7810672 to your computer and use it in GitHub Desktop.
Save sunkibaek/7810672 to your computer and use it in GitHub Desktop.
PHP Sessions
<?php
header("Location: file_name.php"); // redirect to file_name.php
?>
<?php
session_start(); // create or use session
$_SESSION['username'] = 'my_user_name'; // save a username in session
$_SESSION['username'] = 'another_user_name'; // override the value
unset $_SESSION['username']; // destroy the variable
session_destroy(); // end the session
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment