dsdvr06648 2019-04-26 23:54
浏览 133

刷新时不会加载新数据

Im trying to set a session cookie when someone tries to log in, and the concept is working, but for some reason the new data wont load after just refreshing the page (or using location.refresh() in my case). When a user signs in a session cookie gets added but as i said it doesnt get detected on refresh / reload. But when i close the tab and open it again it works fine.

Php code:

<?php
if (!isset($_COOKIE['__sessionID'])) {
    header('location: /login');
} else {
    include 'main.php';
}
?>

Js:

socket.on('adminSuccess', function(data) {
     setCookie('__sessionID', data.sessionID);
     location.reload();
});   
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微带串馈天线阵列每个阵元宽度计算
    • ¥15 关于无人驾驶的航向角
    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了