PHP 8.4.22 Released!

SessionUpdateTimestampHandlerInterface arayüzü

(PHP 7, PHP 8)

Giriş

SessionUpdateTimestampHandlerInterface özel bir oturum işleyici oluşturmak için seçimlik yöntemleri tanımlayan bir arayüzdür. Özel oturum işleyicinin session_set_save_handler() işlevine aktarımı sırasında kullanılan sınıf bu arayüzü gerçekleyebilir.

Bu arayüzün geriçağırım yöntemlerinin PHP tarafından dahili olarak çağrılmak üzere tasarlandığı, kullanıcı tarafından kod içinde kullanılmak üzere tasarlanmadığı unutulmamalıdır.

Sınıf Sözdizimi

interface SessionUpdateTimestampHandlerInterface {
/* Yöntemler */
public function updateTimestamp(string $kimlik, string $veri): bool
public function validateId(string $kimlik): bool
}

İçindekiler

add a note

User Contributed Notes 2 notes

up
0
polygon dot co dot in at gmail dot com
4 days ago
I found that the updateTimestamp has special function.

Seems this was specifically meant for updating timestamp for Cookie based session.

When we use Cookie as a mode of storage of session data we need to maintain the timestamp inside the cookie data.

Generally, when we use other modes we have timestamp details for when it was last accessed. I. case of Cookie this details is with browser as the modified data is set at that moment but not inside the cookie.

So, if we need the last accessed timestamp we can add a kay for the timestamp.

The hack is we need to use session option ['serialize_handler' => 'php_serialize'] so that unserialize add required timestamp key and re serialize it.

I think the 'php_serialize' is the only option which helps to decode the sessionData inside the Session Handler class.
up
0
Anonymous
6 years ago
There is a bit of documentation provided by Wu Xiancheng. See his comment in the SessionHandlerInterface section:
https://www.php.net/manual/en/class.sessionhandlerinterface.php#122032
To Top