Swoole\Http\Response->rawCookie()

4.x is outdated, please check the latest version 22.x


Latest version: pecl install openswoole-22.1.2

Declaration

<?php Swoole\Http\Response->rawCookie(string $key, string $value = '', int $expire = 0, string $path = '/', string $domain = '', bool $secure = false, bool $httponly = false, string $samesite = '', string $priority = '')

Parameters

key

The key/name of the cookie

value

The value/contents of the cookie

expire

The expire time of the cookie, a Unix timestamp in seconds

path

The path of cookie of which it will be available on, the default means it will be available on the entire domain

domain

The (sub)domain of the cookie which it is valid on

secure

If the cookie is secure, using HTTPS

httponly

If the cookie is HTTP only, no JavaScript is allowed to access it

samesite

Set the samesite value for the cookie

priority

Set the cookie priority

Return

successful

No value is returned

fails

If setting the header fails, then false will be returned

Description

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.

Last updated on September 16, 2022