Skip to content

Instantly share code, notes, and snippets.

@gabrieljmj
Created September 19, 2013 19:28
Show Gist options
  • Save gabrieljmj/6628624 to your computer and use it in GitHub Desktop.
Save gabrieljmj/6628624 to your computer and use it in GitHub Desktop.
A helper to work with sessions in php
<?php
class Session{
public static function add( $name, $value ){
$_SESSION[ $name ] = $value;
}
public static function del( $name ){
unset( $_SESSION[ $name ] );
}
public static function get( $name ){
return $_SESSION[ $name ];
}
public static function exists( $name ){
return isset( $_SESSION[ $name ] );
}
public static function startAll(){
session_start();
}
public static function destroyAll(){
session_destroy();
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment