You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: user_guide_src/source/outgoing/response.rst
+24-25Lines changed: 24 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -370,7 +370,7 @@ The methods provided by the parent class that are available are:
370
370
:param string $prefix: Cookie name prefix
371
371
:param bool $secure: Whether to only transfer the cookie through HTTPS
372
372
:param bool $httponly: Whether to only make the cookie accessible for HTTP requests (no JavaScript)
373
-
:param string $samesite: The value for the SameSite cookie parameter. If set to ``''``, no SameSite attribute will be set on the cookie. If set to `null`, the default value from `config/App.php` will be used
373
+
:param string $samesite: The value for the SameSite cookie parameter. If set to ``''``, no SameSite attribute will be set on the cookie. If set to ``null``, the default value from **app/Config/Cookie.php** will be used
374
374
:rtype: void
375
375
376
376
Sets a cookie containing the values you specify. There are two ways to
@@ -384,30 +384,31 @@ The methods provided by the parent class that are available are:
384
384
385
385
.. literalinclude:: response/023.php
386
386
387
-
**Notes**
388
-
389
-
Only the name and value are required. To delete a cookie set it with the
390
-
expiration blank.
387
+
Only the ``name`` and ``value`` are required. To delete a cookie set it with the
388
+
``expire`` blank.
391
389
392
-
The expiration is set in **seconds**, which will be added to the current
390
+
The ``expire`` is set in **seconds**, which will be added to the current
393
391
time. Do not include the time, but rather only the number of seconds
394
-
from *now* that you wish the cookie to be valid. If the expiration is
392
+
from *now* that you wish the cookie to be valid. If the ``expire`` is
395
393
set to zero the cookie will only last as long as the browser is open.
396
394
395
+
.. note:: But if the ``value`` is set to empty string and the ``expire`` is set to ``0``,
396
+
the cookie will be deleted.
397
+
397
398
For site-wide cookies regardless of how your site is requested, add your
398
-
URL to the **domain** starting with a period, like this:
399
+
URL to the ``domain`` starting with a period, like this:
399
400
.your-domain.com
400
401
401
-
The path is usually not needed since the method sets a root path.
402
+
The ``path`` is usually not needed since the method sets a root path.
402
403
403
-
The prefix is only needed if you need to avoid name collisions with
404
+
The ``prefix`` is only needed if you need to avoid name collisions with
404
405
other identically named cookies for your server.
405
406
406
-
The secure flag is only needed if you want to make it a secure cookie
407
+
The ``secure`` flag is only needed if you want to make it a secure cookie
407
408
by setting it to ``true``.
408
409
409
-
The SameSite value controls how cookies are shared between domains and sub-domains.
410
-
Allowed values are 'None', 'Lax', 'Strict' or a blank string ``''``.
410
+
The ``samesite`` value controls how cookies are shared between domains and sub-domains.
411
+
Allowed values are ``'None'``, ``'Lax'``, ``'Strict'`` or a blank string ``''``.
411
412
If set to blank string, default SameSite attribute will be set.
412
413
413
414
**Discrete Parameters**
@@ -425,18 +426,16 @@ The methods provided by the parent class that are available are:
425
426
:param string $prefix: Cookie name prefix
426
427
:rtype: void
427
428
428
-
Delete an existing cookie by setting its expiry to ``0``.
429
-
430
-
**Notes**
429
+
Delete an existing cookie.
431
430
432
-
Only the name is required.
431
+
Only the ``name`` is required.
433
432
434
-
The prefix is only needed if you need to avoid name collisions with
433
+
The ``prefix`` is only needed if you need to avoid name collisions with
435
434
other identically named cookies for your server.
436
435
437
-
Provide a prefix if cookies should only be deleted for that subset.
438
-
Provide a domain name if cookies should only be deleted for that domain.
439
-
Provide a path name if cookies should only be deleted for that path.
436
+
Provide a ``prefix`` if cookies should only be deleted for that subset.
437
+
Provide a ``domain`` name if cookies should only be deleted for that domain.
438
+
Provide a ``path`` name if cookies should only be deleted for that path.
440
439
441
440
If any of the optional parameters are empty, then the same-named
442
441
cookie will be deleted across all that apply.
@@ -456,10 +455,10 @@ The methods provided by the parent class that are available are:
456
455
457
456
**Notes**
458
457
459
-
Only the name is required. If a prefix is specified, it will be prepended to the cookie name.
458
+
Only the ``name`` is required. If a ``prefix`` is specified, it will be prepended to the cookie name.
460
459
461
-
If no value is given, the method just checks for the existence of the named cookie.
462
-
If a value is given, then the method checks that the cookie exists, and that it
460
+
If no ``value`` is given, the method just checks for the existence of the named cookie.
461
+
If a ``value`` is given, then the method checks that the cookie exists, and that it
463
462
has the prescribed value.
464
463
465
464
Example:
@@ -473,7 +472,7 @@ The methods provided by the parent class that are available are:
473
472
:rtype: ``Cookie|Cookie[]|null``
474
473
475
474
Returns the named cookie, if found, or ``null``.
476
-
If no name is given, returns the array of ``Cookie`` objects.
475
+
If no ``name`` is given, returns the array of ``Cookie`` objects.
0 commit comments