28 lines
822 B
PHP
28 lines
822 B
PHP
<?php
|
|
include_once "Reflection.php";
|
|
class RequestCookie {
|
|
use ReflectionHook;
|
|
static $_attributes = [];
|
|
static $readyHeaders = false;
|
|
function __construct()
|
|
{
|
|
if(!RequestCookie::$readyHeaders)
|
|
{
|
|
RequestCookie::$_attributes = (array) $_COOKIE;
|
|
};
|
|
}
|
|
function setAttribute($name, $value, $time = '+1 years')
|
|
{
|
|
$formarly = strtolower($name);
|
|
setcookie($name, $value, strtotime( $time ));
|
|
}
|
|
function getAttribute($name)
|
|
{
|
|
$formarly = strtolower($name);
|
|
return RequestCookie::$_attributes[$formarly];
|
|
}
|
|
function removeAttribute($name)
|
|
{
|
|
$this->setAttribute($name, 0, "-1 days");
|
|
}
|
|
}; |