web\MultiFieldSession $writeCallback

$writeCallback public property

A callback that will be called during session data writing. The signature of the callback should be as follows:

function ($session)

where $session is this session instance, this variable can be used to retrieve session data. Callback should return the actual fields set, which should be saved into the session storage.

For example:

function ($session) {
    return [
        'user_id' => Yii::$app->user->id,
        'ip' => $_SERVER['REMOTE_ADDR'],
        'is_trusted' => $session->get('is_trusted', false),
    ];
}
public callable $writeCallback = null
doc_Yii
2016-10-30 17:15:20
Comments
Leave a Comment

Please login to continue.