我注意到我的php會話ID在我從https://www.mathtutortime.com/tutor/tutor https://www.mathtutortime.com/account/get_tutoring/lobby.html。它工作得很好,如果我從https://www.mathtutortime.com/account/ https://www.mathtutortime.com/account/get_tutoring/lobby.html。我以為會話ID不會保留在不同的域上。我在 https://www.mathtutortime.com/tutor/tutor 的代碼具有我已經存儲的會話信息https://www.mathtutortime.com/tutor。https://www.mathtutortime.com/tutor/tutor 中的代碼是:<?php session_start(); ?><!DOCTYPE html><html> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script> window.location.replace("https://www.mathtutortime.com/account/get_tutoring/lobby.html") </script> </head> <body> </body></html>在大堂.html,我有:<?php session_start();echo session_id();if($_SESSION['loggedin']){ echo "yelo"; if(!$_SESSION['tutor'] && $_SESSION['minutes'] > 0) {...?>現在,如果我重新加載大廳.html重定向后,會話ID似乎重置回原來的狀態。這意味著它在重新加載頁面后工作。我認為這是因為我能夠超越if($_SESSION['loggedin'])部分.html,當我回顯它時,我可以看到會話ID更改。因此,我認為會話信息確實存在,但只有當我使用window.location.replace等進行重定向時才會失效。但我不知道為什么。感謝您的幫助。
為什么會話 ID 不能保留在同一域中
ibeautiful
2022-09-03 14:45:48