diff options
-rw-r--r-- | core/namespace/HTTP.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/namespace/HTTP.php b/core/namespace/HTTP.php index d14b69b..c8aea27 100644 --- a/core/namespace/HTTP.php +++ b/core/namespace/HTTP.php @@ -172,6 +172,20 @@ class HTTP { } #=============================================================================== + # Set cookie + #=============================================================================== + public static function setCookie($name, $value = '', $expire = 31536000): bool { + return setcookie($name, $value, $expire + time(), '/'); + } + + #=============================================================================== + # Get cookie + #=============================================================================== + public static function getCookie($name) { + return $_COOKIE[$name] ?? NULL; + } + + #=============================================================================== # Return HTTP request method or check if request method equals with $method #=============================================================================== public static function requestMethod($method = NULL) { |