开发者

How would I create a session in a PHP class?

开发者 https://www.devze.com 2023-02-19 06:18 出处:网络
I\'m trying to start a session in one class, and assign various values. In the next class I\'m trying to obtain the results of that session?

I'm trying to start a session in one class, and assign various values. In the next class I'm trying to obtain the results of that session? But it's not working what sh开发者_高级运维ould I do?


Impossible to say for sure without code of course, but most common error is forgetting to start your code with:

session_start()

Keep this in mind: (as hinted in the comments by @julioc )

To use cookie-based sessions, session_start() must be called before outputing anything to the browser.

0

精彩评论

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