diff options
author | Thomas Lange <code@nerdmind.de> | 2017-10-23 03:01:23 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2017-10-23 03:01:23 +0200 |
commit | b22b2cc4bdbafeb4a955753e2d92fbc706c79407 (patch) | |
tree | 3d062f6894211fd915de9c96c57906b0ace8fb43 | |
parent | b886b447c939db888aee84224995da58540b4503 (diff) | |
download | blog-b22b2cc4bdbafeb4a955753e2d92fbc706c79407.tar.gz blog-b22b2cc4bdbafeb4a955753e2d92fbc706c79407.tar.xz blog-b22b2cc4bdbafeb4a955753e2d92fbc706c79407.zip |
The methods "setCookie" and "getCookie" have been added to the HTTP class.
-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) { |