Created
February 21, 2014 12:19
-
-
Save susanBuck/9133317 to your computer and use it in GitHub Desktop.
Sessions example
This file contains 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
/*------------------------------------------------------------------------------------------------- | |
Set session helper | |
-------------------------------------------------------------------------------------------------*/ | |
public static function set_session($key,$value = NULL) { | |
$_SESSION[$key] = $value; | |
} | |
/*------------------------------------------------------------------------------------------------- | |
Get session helper | |
-------------------------------------------------------------------------------------------------*/ | |
public static function get_session($key, $unset = true) { | |
if(isset($_SESSION[$key])) { | |
$value = $_SESSION[$key]; | |
if($unset) unset($_SESSION[$key]); | |
return $value; | |
} | |
return NULL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment