The question of PHP using redis to realize single sign-on

We all know that login usually uses session to save a state, which is used to determine whether or not to log in to a website, and different domain names generate different PHPSESSID.
question: if we use redis to implement session sharing for single sign-on, for example, I have two websites, A.com and B.com. Then the PHPSESSID I generated when I logged in to website An and the PHPSESSID generated on website B must be different. If I log in on website An and save session on redis, how can I tell when I visit bilibili that I have already logged in at Station A, so as not to log in to bilibili?

Mar.23,2021

what you say is contradictory: "question: if we use redis to achieve session sharing for single sign-on, for example, I have A.com and B.com. Then the PHPSESSID I generated when I logged in to website An and the PHPSESSID generated on website B must be different. " Session sharing is to ensure that the key of multi-domain name redis is unique. When logging in, you need to determine whether there is a generated and non-expired session;. As for the generation of session key, you can customize it, for example, you can use user id to generate session key.


if you use redis to store session data, you can make the session_id of multiple domain names consistent. You can refer to session.cookie_domain set
http://php.net/manual/zh/func.

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b32f15-2be50.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b32f15-2be50.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?