Files
Malawi-Stock-Exchange-API/app/Core/Session.php
Kwesi Banson Jnr 592a161ee6 Initial commit
2026-04-08 05:53:02 +00:00

22 lines
508 B
PHP

<?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;
}
}
?>