From b22b2cc4bdbafeb4a955753e2d92fbc706c79407 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 23 Oct 2017 03:01:23 +0200 Subject: The methods "setCookie" and "getCookie" have been added to the HTTP class. --- core/namespace/HTTP.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 @@ -171,6 +171,20 @@ class HTTP { return self::issetData(self::$FILE, $parameters); } + #=============================================================================== + # 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 #=============================================================================== -- cgit v1.2.3