SessionSection
class SessionSection implements IteratorAggregate, ArrayAccess
Session section.
Properties
| $warnOnUndefined | Emits a warning when accessing an undefined variable in this section |
Methods
Returns an iterator over all section variables.
Sets a variable in this session section. Passing null removes it.
Gets a variable from this session section.
Removes a variable or a list of variables from this section. With no argument, removes the entire section.
Sets the expiration time for the whole section or for specific variables.
Removes the expiration from the whole section or from specific variables.
Details
at line 27
__construct(Session $session, string $name)
Do not call directly. Use Session::getSection().
at line 38
Iterator
getIterator()
Returns an iterator over all section variables.
at line 49
void
set(string $name, mixed $value, string|null $expire = null)
Sets a variable in this session section. Passing null removes it.
The optional $expire sets per-variable expiration as a time string (e.g. '30 seconds').
at line 64
mixed
get(string $name)
Gets a variable from this session section.
at line 79
void
remove(string|array|null $name = null)
Removes a variable or a list of variables from this section. With no argument, removes the entire section.
at line 101
void
__set(string $name, mixed $value)
deprecated
deprecated
Sets a variable in this session section.
at line 112
mixed
__get(string $name)
deprecated
deprecated
Gets a variable from this session section.
at line 129
bool
__isset(string $name)
deprecated
deprecated
Determines whether a variable in this session section is set.
at line 140
void
__unset(string $name)
deprecated
deprecated
Unsets a variable in this session section.
at line 150
void
offsetSet($name, $value)
deprecated
deprecated
Sets a variable in this session section.
at line 161
mixed
offsetGet($name)
deprecated
deprecated
Gets a variable from this session section.
at line 171
bool
offsetExists($name)
deprecated
deprecated
Determines whether a variable in this session section is set.
at line 181
void
offsetUnset($name)
deprecated
deprecated
Unsets a variable in this session section.
at line 192
SessionSection
setExpiration(string|null $expire, string|array|null $variables = null)
Sets the expiration time for the whole section or for specific variables.
Pass null to clear the expiration.
at line 220
void
removeExpiration(string|array|null $variables = null)
Removes the expiration from the whole section or from specific variables.