PHP: session isn't saving before header redirect

后端 未结 10 1354
死守一世寂寞
死守一世寂寞 2020-12-06 17:26

I have read through the php manual for this problem and it seems quite a common issue but i have yet to find a solution. I am saving sessions in a database. My code is as f

10条回答
  •  攒了一身酷
    2020-12-06 18:01

    userID does not have any keyword status.

    Only reason to me, is $_SESSION['userID'] is being overwritten or deleted somewhere.

    Make sure you use session->start() in all the files you want to add/access the session.

    One important thing ( which may not be applicable in your case ) is, if the session is being handled using cookie, cookie can be made to be accessible only under certain directory and subdirectories under that. In your case anyhow, subdirectory will have access to the session.

提交回复
热议问题