Swoole\Http\Response->cookie

Declaration

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

Parameters

key

The key of cookie

value

The value of cookie

expire

The expire time of cookie

path

The path of cookie

domain

The domain of cookie

secure

If the cookie is secure

httponly

If the cookie is HTTP only

samesite

Set the samesite value

Return

Response

Description

Set the cookie sending to HTTP client.

This method must be called before the $response->end method.

Example