Join 4,000+ others and never miss out on new tips, tutorials, and more.
Latest version:
pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5
<?php OpenSwoole\Http\Response->rawCookie(string $key, string $value = '', int $expire = 0, string $path = '/', string $domain = '', bool $secure = false, bool $httponly = false, string $samesite = '', string $priority = '')
The key/name of the cookie
The value/contents of the cookie
The expire time of the cookie, a Unix timestamp in seconds
The path of cookie of which it will be available on, the default means it will be available on the entire domain
The (sub)domain of the cookie which it is valid on
If the cookie is secure, using HTTPS
If the cookie is HTTP only, no JavaScript is allowed to access it
Set the samesite value for the cookie
Set the cookie priority
No value is returned
If setting the header fails, then false
will be returned
Sets a HTTP response cookie which does not encode the cookie value using urlencode
.
This method is the same as the normal $response->cookie(...)
method but rawCookie()
just does not encode the value.
This method must be called before the
$response->end
method.