How to find php session start timestamp

I recall recently that you recently read that you can get the server session start time in the exact timestamp format when the php session was started for the user, but I can not find this article again.

What I don't want is the request time (i.e. time 'REQUEST_TIME') or the "current timestamp" compared to execution date(), because (if I understand them correctly), they will change for each request and each script execution.

What I want is the time when the session was initiated on the server, and this logically can be only one point in time.

Apparently, this information was received.

Can anyone help?

+5
source share
3

:

if (!isset($_SESSION['started'])) {
    $_SESSION['started'] = $_SERVER['REQUEST_TIME'];
}
+8
if (!isset($_SESSION['start_time']))
{
    $str_time = time();
    $_SESSION['start_time'] = $str_time;
}

echo $_SESSION['start_time'];
+3

$_SESSION['started'] = (!isset($_SESSION['started'] ? time() : $_SESSION['started']);
+2

All Articles