Multiple sessions in one instance using PHP?

后端 未结 4 1566
既然无缘
既然无缘 2021-01-15 09:44

I have a project where I would like to create two session cookies in one browser. The first session would be to uniquely identify a person, the second would be to share even

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-15 09:59

    Where is the "valueSharedBetweenUsers" coming from? Is it a constant or database entry?

    Either way, it wouldn't make sense to create one session per group. You should instead be giving each user a unique session per user; with your "shared" attribute as a session attribute for each individual.

    So start the unique session then just do

    Now everyone has a session with a unique sessionID and a common value 'session'.

    (Obviously if you need to change this attribute later you'll have to do it separately for each authed individual)

提交回复
热议问题