Session_id cross-origin problem-php Tutorial

Source: Internet
Author: User
3.x.com: can session4.xyun be set to get the session through session_id? why can't I get the session? how can I set 3.x.com?
Set session

4. can xyun get the session through session_id?

Why cannot I obtain
How to set

Reply content:

3.x.com
Set session

4. can xyun get the session through session_id?

Why cannot I obtain
How to set

It depends on whether you are using different subdomains of the same domain name or different domain names. if you are using the former, you only need to set the domain parameter of CookieExample.com(Top-level domain name), you can get Session_id under other subdomains. if it is the latter, it involves SSO (single sign-on). This is complicated, this mainly involves the Session implementation principle, it is recommended to refer to: https://www.zhihu.com/question/19779937

@ Leiliang520130 and @ mestang only implement cross-server, and there is no dime relationship between cross-origin with Session.

You can put the session in redis, and connect to the same redis under two different domain names to set a get

You can use memcached or redis to store sessions in php. ini, so that the session can be stored across servers. Implementation is very simple.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.