$sessionsetFor()

Set a session variable within a given namespace

To remove a namespace, use $session->remove($namespace).

Example

// Set a session value for a namespace
$session->setFor($this, 'firstName', 'Bob'); 

Usage

$session->setFor($ns, string $key, mixed $value);

Arguments

NameType(s)Description
$nsstring object

Namespace string or object.

$keystring

Name of session variable you want to set.

$valuemixed

Value you want to set, or specify null to unset.

Return value

$this

Object instance it was called from (method supports fluent interface).


$session methods and properties

API reference based on ProcessWire core version 3.0.252