Pan*_*kaj 13 php laravel laravel-5 laravel-5.1 laravel-5.2
此表中的示例数据如下所示:
表中存在多个重复的用户会话记录.
供应商\ laravel \框架的\ src \照亮\会议\ DatabaseSessionHandler.php
在上面的文件路径中,我们有以下方法
public function write($sessionId, $data)
{
$payload = $this->getDefaultPayload($data);
if (! $this->exists) {
$this->read($sessionId);
}
if ($this->exists) {
$this->getQuery()->where('id', $sessionId)->update($payload);
} else {
$payload['id'] = $sessionId;
$this->getQuery()->insert($payload);
}
$this->exists = true;
}
Run Code Online (Sandbox Code Playgroud)
它检查会话ID.
题
我可以避免在会话表中创建重复的用户会话记录吗?在Session Config文件中是否有任何标志?
看来你的行为有误,一定是这样吧?:
if (! $this->exists) {
$this->read($sessionId);
}else{
if ($this->exists) {
$this->getQuery()->where('id', $sessionId)->update($payload);
} else {
$payload['id'] = $sessionId;
$this->getQuery()->insert($payload);
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1024 次 |
最近记录: |