SessionUpdateTimestampHandlerInterface::updateTimestamp

(PHP 7, PHP 8)

SessionUpdateTimestampHandlerInterface::updateTimestampMettre à jour l'horodatage

Description

public SessionUpdateTimestampHandlerInterface::updateTimestamp(string $id, string $data): bool

Met à jour l'horodatage de dernière modification de la session. Cette fonction est automatiquement exécuté quand une session est mise à jour.

Liste de paramètres

id

L'ID de session.

data

Les données de session.

Valeurs de retour

Retourne true si l'horodatage a été mis à jour, false sinon. Il est à noter que cette valeur est retourné internellement à PHP pour du traitement.

add a note add a note

User Contributed Notes 2 notes

up
1
ohcc at 163 dot com
1 year ago
When session.lazy_write is enabled, which is the default behaviour, session data will NOT be UPDATED if it remains unchanged, in this way the WRITE method of the session handler will not be called at all.

If your session handler storages session data into files, UpdateTimestamp is used to update the "last modified time" of the session file, if your session handler storages session data into a database, UpdateTimestamp is used to update the table field that storages the last modified time of the session registry.
up
0
ohcc at 163 dot com
1 year ago
'validateId' is called after 'open' and before 'read' to validate the session id provided by the client, as 'open' -> 'validateId' -> 'read' -> 'write' -> 'close' are called in sequence.

If 'validateId' returns false, a new session id will be generated, the session cookie will also be updated afterwards.
To Top