php - 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;
}
解决方案
推荐阅读
- javascript - Wix 网站路由器页面代码执行两次。在准备好的页面上,我正在执行 Wix Velo 的 OrderPlan 功能。创建 2 个具有相同计划的订阅
- python - Pandas:比较数据框中组内的行并创建摘要行以标记/突出显示组中的不同条目
- ngrok - 你如何从 cli 切换 ngrok 帐户?
- flutter - 如何使用 GetConnect 修复 api refreshToken 调用多次
- c# - getfiles 中是否有特定扩展名的搜索模式(多个)?
- flutter - 在 iOS 15 beta 上使用 canvaskit 进行 Flutter web
- reactjs - 在我的 App 组件中导入 i18n 后,组件消失了
- android - Why i see Lost device connection message when open gallery using image_picker?
- c++ - Make valgrind to collect the data on request
- amazon-web-services - EMR stuck at bootstrap script