note 125242 added to function.setcookie
| From: | Anonymous@php.net | Date: | Tue, 04 Aug 2020 16:24:01 +0000 |
| Subject: | note 125242 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-214925@lists.php.net to get a copy of this message | ||
Just an example to clarify the use of the array options, especially since Mozilla is going to
deprecate / penalise the use of SameSite = none, which is used by default if not using array
options.
<?php
$arr_cookie_options = array (
'expires' => time() + 60*60*24*30,
'path' => '/',
'domain' => '.example.com', // leading dot for compatibility or use
subdomain
'secure' => true, // or false
'httponly' => true, // or false
'samesite' => 'None' // None || Lax || Strict
);
setcookie('TestCookie', 'The Cookie Value', $arr_cookie_options);
?>
----
Server IP: 45.112.84.4
Probable Submitter: 103.51.166.36 (proxied: 181.58.185.163)
----
Manual Page -- http://php.net/manual/en/function.setcookie.php
Edit -- https://master.php.net/note/edit/125242
Del: integrated -- https://master.php.net/note/delete/125242/integrated
Del: useless -- https://master.php.net/note/delete/125242/useless
Del: bad code -- https://master.php.net/note/delete/125242/bad+code
Del: spam -- https://master.php.net/note/delete/125242/spam
Del: non-english -- https://master.php.net/note/delete/125242/non-english
Del: in docs -- https://master.php.net/note/delete/125242/in+docs
Del: other reasons-- https://master.php.net/note/delete/125242
Reject -- https://master.php.net/note/reject/125242
Search -- https://master.php.net/manage/user-notes.php