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.


Top ↑

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


Top ↑

Return Return

(boolean)


Top ↑

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).
	 *


Top ↑

Changelog Changelog

Changelog
Version Description
5.3.0 Moved location from includes/llms.functions.core.php.
4.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.