Any reason why I wouldn’t be able to access $_SESSION vars I created in “Class A” within a different class, say “Class B”? If I var_dump outside of the Class B, its fine, but within Class B, its report undefined.
Any help would be awesome!
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming you have started a session (session_start()) somewhere in your code you should be able to access the $_SESSION superglobal from anywhere within the same request.
If you’re loading class B in a separate request, make sure you’ve started the session. If this still doesn’t work, look at your php configuration.