I have a pretty dumb question (I believe):
What would happen, if I were to start 2 sessions, calling session_start()
twice? For example, I have a class User
, where I start user's session, and a class Error
, in which I start another session, so I can store errors and notifications in them and pass them to other pages.
Could I run into a problem, and is this efficient?
PHP doesn't support multiple simultaneous sessions. Calling session_start()
a second time in a request doesn't do anything unless the existing session was destroyed (via session_destroy()
).
session_start()
creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie.
http://php.net/session-start
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With