Cannot access the session array with php

后端 未结 3 1367
孤街浪徒
孤街浪徒 2020-12-11 23:13

I am working in a subfolder on my website: www.example.com/subfolder

Now, i want to set a session that is only accessible within www.example.com/subfolder

To

相关标签:
3条回答
  • 2020-12-11 23:36

    _SESSION is superglobal. It is in global scope.

    So, you have probably forgot session_start();

    0 讨论(0)
  • 2020-12-11 23:38

    Have you used session_start() anywhere before that code ?

    I also suggest using var_dump() instead of print_r() to debug values as print_r doesn't output null values, hence creating some confusion sometimes.

    0 讨论(0)
  • 2020-12-11 23:51

    You need to call session_start first (unless you have session.auto_start set to 1).

    0 讨论(0)
提交回复
热议问题