Home > Backend Development > PHP Tutorial > session_id cross-domain issue

session_id cross-domain issue

WBOY
Release: 2016-07-06 13:53:08
Original
962 people have browsed it

3.x.com
Set session

4. Can xyun obtain the session through session_id

Why can’t be obtained?
How to set it up

Reply content:

3.x.com
Set session

4. Can xyun obtain the session through session_id

Why can’t be obtained?
How to set it up

This depends on whether you are across different subdomains of the same domain name, or across different domain names. If it is the former, you only need to set the domain parameter of the cookie to example.com (top-level domain name), and it will work under other subdomains. Obtain the Session_id. If it is the latter, it involves SSO (single sign-on). This is more complicated. This mainly involves the implementation principle of Session. It is recommended to refer to: https://www.zhihu.com/question/19779937

@leiliang520130 and @mistang’s method only realizes cross-server and has nothing to do with Session cross-domain.

You can put the session into redis. Two different domain names can be connected to the same redis, one set and one get

You can set up memcached or redis in php.ini to store sessions, so that they can be stored across servers. The implementation is very simple.

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template