Home > Backend Development > PHP Tutorial > javascript - Please tell me about the problem of session loss when switching domain name by ip

javascript - Please tell me about the problem of session loss when switching domain name by ip

WBOY
Release: 2016-08-04 09:20:10
Original
1557 people have browsed it

Before, the front-end page and interface were in the same directory on the server
They were all accessed using IP
After that, the front-end page had a domain name and was no longer accessed by IP. The interface was still accessed by IP
Then cross-domain and SESSION loss problems occurred?
Please tell me how to deal with it?

Reply content:

Before, the front-end page and interface were in the same directory on the server
They were all accessed using IP
After that, the front-end page had a domain name and was no longer accessed by IP. The interface was still accessed by IP
Then cross-domain and SESSION loss problems occurred?
Please tell me how to deal with it?

  1. The simple and effective way is to assign a domain name of the same domain to your interface

  2. Of course there is a way to pass the session id through the URL, but the compatibility of this method is really poor

  3. Exceptionally important! ! Why does the interface need Session! ?

For interfaces, token verification is generally used
Of course, PHP has a session solution. I have to get off work and will talk about it tomorrow

Related labels:
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