LLMS_Abstract_Session_Data::set( string $key, mixed $value )
Set a session variable.
Parameters Parameters
- $key
-
(string) (Required) The key of the session variable.
- $value
-
(mixed) (Required) The value of the session variable.
Return Return
(mixed)
Source Source
File: includes/abstracts/llms-abstract-session-data.php
public function set( $key, $value ) {
/**
* Using `isset()` allows us to explicitly save a value of `false`
* since the `get()` method will return the default value `false` making it look
* as if the value hasn't changed (when it actually has).
*/
if ( ! isset( $this->$key ) || $value !== $this->get( $key ) ) {
$this->data[ sanitize_key( $key ) ] = maybe_serialize( $value );
$this->is_clean = false;
}
return $this->get( $key );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 4.0.0 | Moved from LLMS_Session. |
| 1.0.0 | Introduced. |