Initial commit
This commit is contained in:
22
app/Core/Session.php
Normal file
22
app/Core/Session.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace App\Core;
|
||||
|
||||
class Session {
|
||||
public static function start() {
|
||||
if (session_status() === PHP_SESSION_NONE) session_start();
|
||||
}
|
||||
|
||||
public static function setFlash($key, $message) {
|
||||
self::start();
|
||||
$_SESSION['flash'][$key] = $message;
|
||||
}
|
||||
|
||||
public static function getFlash($key) {
|
||||
self::start();
|
||||
$message = $_SESSION['flash'][$key] ?? null;
|
||||
unset($_SESSION['flash'][$key]); // Delete after retrieval
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user