P粉4587250402023-09-04 10:39:55
This PHP code works fine for me. There may be something wrong with your environment settings. You can check the settings in your .ini
file, or your browser settings, to ensure that the browser stores and sends the session ID cookie on every request. Without this cookie, the server does not know which session to start.
Try running a file with phpinfo()
and search for all settings under session
. This may point to a problem with the .ini file. You can also open your browser's developer tools and view your site's Applications tab. There should be a cookie stored on your site associated with the session name, probably PHPSESSID
.