Provide immediate access to set cookies.

This commit is contained in:
Taylor Otwell 2011-11-18 10:43:37 -06:00
parent 570b431c05
commit 374f72f5e5
1 changed files with 9 additions and 2 deletions

View File

@ -88,7 +88,14 @@ public static function put($name, $value, $minutes = 0, $path = '/', $domain = n
{
if (headers_sent()) return false;
if ($minutes < 0) unset($_COOKIE[$name]);
if ($minutes < 0)
{
unset($_COOKIE[$name]);
}
else
{
$_COOKIE[$name] = $value;
}
$time = ($minutes !== 0) ? time() + ($minutes * 60) : 0;
@ -128,4 +135,4 @@ public static function forget($name)
return static::put($name, null, -2000);
}
}
}