public static function setCookie(string $key, $value = null, int $time = 604800): void // Week?
    {
        if (headers_sent()) {
            $_SESSION['Cookies'][] = [$key => [$value, $time]];
        } else {
            setcookie($key, $value, time() + $time, '/', SITE, HTTPS, true);
        }
    }
public static function setCookie(string $key, $value = null, int $time = 604800): void // Week?
    {
        if (headers_sent()) {
            $_SESSION['Cookies'][] = [$key => [$value, $time]];
        } else {
            setcookie($key, $value, time() + $time, '/', SITE, HTTPS, true);
        }
    }
public static function setCookie ( string $ key , $ value = null , int $ time = 604800 ) : void // Week? { if ( headers_sent ( ) ) { $ _SESSION [ 'Cookies' ] [ ] = [ $ key => [ $ value , $ time ] ] ; } else { setcookie ( $ key , $ value , time ( ) + $ time , '/' , SITE , HTTPS , true ) ; } }
Cookies are a pain to set up as they also rely on headers not being sent.
This method makes setting cookies easy with three params.
@param string $key the name of the cookie
@param mixed $value
@param int $time the expiration time of our cookie
Cookies are a pain to set up as they also rely on headers not being sent . This method makes setting cookies easy with three params .