Last active
December 30, 2015 09:39
-
-
Save sunkibaek/7810672 to your computer and use it in GitHub Desktop.
PHP Sessions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header("Location: file_name.php"); // redirect to file_name.php | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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