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条回答 默认 最新

    报告相同问题?