setcookie
brefphp/bref
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Send a cookie
setcookie
(
string $name
,
string $value
=
""
,
int $expires_or_options
=
0
,
string $path
=
""
,
string $domain
=
""
,
bool $secure
=
false
,
bool $httponly
=
false
):
bool
<?
php
declare(
strict_types
=
1
);
setcookie
(
'MyCookie'
,
'FirstValue'
,
1515745923
,
'/hello/'
,
'example.com'
,
true
,
true
);
setcookie
(
'MyCookie'
,
'MyValue'
,
1515745923
,
'/hello/'
,
'example.com'
,
true
,
true
);
tests/Handler/PhpFpm/cookies.php
<?
php
declare(
strict_types
=
1
);
setcookie
(
'MyCookie'
,
'FirstValue'
,
1515745923
,
'/hello/'
,
'example.com'
,
true
,
true
);
setcookie
(
'MyCookie'
,
'MyValue'
,
1515745923
,
'/hello/'
,
'example.com'
,
true
,
true
);
tests/Handler/PhpFpm/cookies.php