In php 开发者_StackOverflowhow to handle different sessions in same browser?
You could possibly look into session_name(), and retrieve sessions based on a name parameter. But I don't see anything that you can't handle using a single session; even perhaps having an Administrator user log in as a Regular user to act as that user.
Cookies or set session_id() before session_start() but the later is not recomended , use cookies instead of session if you need multiple sessions in the same browser .
Use the session id in the url and use set_session_id()
to set it at the start of each request.
The disadvantage is that a session may be restored in a new browser session because the url with id can be reopened in a new browser instance or even a different browser.
But why would you need to do this?
Use cookpie
that handle different session
You could use a querystring with a unique ID which you set during login, and use that to find the session variable you need.
Another easy trick if you need multiple sessions just for yourself is to use subdomains (www1.url.com, www2.url.com) as session information is stored for each unique domain.
精彩评论