PHPDaemon\HTTPRequest\Generic::setcookie PHP Method

setcookie() public method

Set the cookie
public setcookie ( string $name, string $value = '', integer $maxage, string $path = '', string $domain = '', boolean $secure = false, boolean $HTTPOnly = false ) : void
$name string Name of cookie
$value string Value
$maxage integer Optional. Max-Age. Default is 0
$path string Optional. Path. Default is empty string
$domain string Optional. Domain. Default is empty string
$secure boolean Optional. Secure. Default is false
$HTTPOnly boolean Optional. HTTPOnly. Default is false
return void
    public function setcookie($name, $value = '', $maxage = 0, $path = '', $domain = '', $secure = false, $HTTPOnly = false)
    {
        $this->header('Set-Cookie: ' . $name . '=' . rawurlencode($value) . (empty($domain) ? '' : '; Domain=' . $domain) . (empty($maxage) ? '' : '; Max-Age=' . $maxage) . (empty($path) ? '' : '; Path=' . $path) . (!$secure ? '' : '; Secure') . (!$HTTPOnly ? '' : '; HttpOnly'), false);
    }