public function SessionHandler::read
public SessionHandler::read($sid)
Reads the session data.
Parameters
string $sessionId Session ID, see http://php.net/function.session-id:
Return value
string Same session data as passed in write() or empty string when non-existent or on failure
Overrides SessionHandlerInterface::read
See also
http://php.net/sessionhandlerinterface.read
File
- core/lib/Drupal/Core/Session/SessionHandler.php, line 56
Class
- SessionHandler
- Default session handler.
Namespace
Drupal\Core\SessionCode
public function read($sid) { $data = ''; if (!empty($sid)) { // Read the session data from the database. $query = $this->connection ->queryRange('SELECT session FROM {sessions} WHERE sid = :sid', 0, 1, [':sid' => Crypt::hashBase64($sid)]); $data = (string) $query->fetchField(); } return $data; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Session!SessionHandler.php/function/SessionHandler::read/8.1.x