Skip to content

Instantly share code, notes, and snippets.

@mucahit
Last active August 29, 2015 14:03
Show Gist options
  • Save mucahit/6429d7b4c3efdd04ff3b to your computer and use it in GitHub Desktop.
Save mucahit/6429d7b4c3efdd04ff3b to your computer and use it in GitHub Desktop.
Session class with php ♥
<?php
class sess
{
public static function create($array){
foreach ($array as $key => $value) {
#create session
$_SESSION[$key] = $value;
}
}
public static function delete(){
#delete session
session_destroy();
}
public static function session($name){
if(@$_SESSION[$name]){
return $_SESSION[$name];
}else{
return false;
}
}
}
?>
<?php
$array = array(
'name' => 'riza',
'sifre' => 'kel123',
'id' => 3
);
sess::create($array); //oluşturduk
sess::session('name'); //gösterdik
//sess::delete(); sildik
?>
@riza
Copy link

riza commented Jul 16, 2014

ay cok ttlsn grcktn 🍺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment