开发者

Why is $_SESSION not carrying data to separate PHP file?

I have a login page that sets a $_SESSION['usertype'] w开发者_高级运维hen I log in. I have a separate PHP file that contains a menu that loads on the side. That file is loaded on every PHP file through

<?php include('menu.php') ?>

But when I check for $_SESSION['usertype'] in menu.php, it is not set.

Why is this?


Just checking whether you're using session_start() before you include the file which needs to access $_SESSION['usertype']?

Have a check through this tutorial.


Do you have session_start() at the top of menu.php or before the include of menu.php?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜