llms_setcookie( string $name, string $value = '', int $expires, string $path = '', string $domain = '', bool $secure = false, bool $httponly = false )
Set a cookie.
Description Description
A pluggable wrapper for the native PHP function set_cookie()
.
The lifterlms-tests library plugs this function during unit testing so we can mock the returns of methods that set cookies and write tests for those functions.
Parameters Parameters
- $name
-
(string) (Required) The name of the cookie.
- $value
-
(string) (Optional) The value of the cookie.
Default value: ''
- $expires
-
(int) (Required) The time wehn the cookie expires as a Unix timestamp.
- $path
-
(string) (Optional) The path on the server where the cookie will be available.
Default value: ''
- $domain
-
(string) (Optional) The (sub)domain that the cookie is available to.
Default value: ''
- $secure
-
(bool) (Optional) Indicates the cookie should only be transmitted over a secure HTTPS connection.
Default value: false
- $httponly
-
(bool) (Optional) When
true
the cookie will only be made accessible through the HTTP protocol, preventing it from being accessed by scripting languages (such as Javascript).Default value: false
Return Return
(boolean)
Source Source
File: includes/functions/llms-functions-wrappers.php
* @param bool $httponly When `true` the cookie will only be made accessible through the HTTP protocol, * preventing it from being accessed by scripting languages (such as Javascript). *
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.3.0 | Moved location from includes/llms.functions.core.php . |
4.0.0 | Introduced. |