Documentation

SessionInterface

Methods for handling sessions.

Method Description Available from version
\Bitrix\Main\Session\SessionInterface::start()
Starts a session, assigns necessary options for secure operation, calls session_start(). Repeated method call doesn't return error and a restart.
\Bitrix\Main\Session\SessionInterface::getId()
Gets session ID.
\Bitrix\Main\Session\SessionInterface::setId($id)
Sets session ID. When session is active, throws an exception \RuntimeException.
\Bitrix\Main\Session\SessionInterface::getName()
Gets session name.
\Bitrix\Main\Session\SessionInterface::setName($name)
Sets session name. In case of active session, throws an exception \RuntimeException.
\Bitrix\Main\Session\SessionInterface::regenerateId(): bool
Generates new session ID with saving all values. Contrary to the session_regenerate_id() considers possible issues with unstable internet connection.
\Bitrix\Main\Session\SessionInterface::save()
Saves session data and closes it.
\Bitrix\Main\Session\SessionInterface::has($name)
Returns true, when session has the key $name.
\Bitrix\Main\Session\SessionInterface::get($name)
Returns value in session by the key $name.
\Bitrix\Main\Session\SessionInterface::set($name, $value)
Sets the $value by the key $name.
\Bitrix\Main\Session\SessionInterface::remove($name)
Deletes value in session by key $name.
\Bitrix\Main\Session\SessionInterface::clear()
Deletes all values, available in session.
\Bitrix\Main\Session\SessionInterface::isStarted()
Returns true when session has started successfully.


© «Bitrix24», 2001-2024
Up