如何解决symfony 4.4获取会话ID,并根据匹配的会话ID删除mariadb中的记录
会话ID是“会话”表和另一个表“ temp_sessions”中的主键 注销后,将调用logout.PHP文件,并执行以下部分。 如何编写SQL查询以匹配主键(在本例中为会话ID),然后将其从另一个sql表中删除?
*/
public function logout(MyUser $user)
{
$url = $this->getServiceUrl(__FUNCTION__);
try {
$this->logger->debug("SERVICE CALLED | Url: $url");
$response = $this->getClient()->post($url,[
'json' => [
'session_id' => $user->getSessionId(),]
]);
$real_session_id = $request->getSession()->get('_session_id');
$sess_id = $request->getSession()->getId();
// get the session id here and delete a record in the mariadb***
} catch (\Throwable $exception) {
$this->logger->critical("SERVICE EXCEPTION | Url: $url | Exception: " . $exception->getMessage());
throw new ServiceException($exception->getMessage());
}
$content = $response->getBody()->getContents();
$content = json_decode($content,true);
if ('failure' === $content['result']) {
$this->logger->error("SERVICE FAILURE | Url: $url | Message: {$content['message']}");
throw new ServiceException($content['message']);
}
return $content;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。