Transmission of session information based on the URL of the website address. tutorial on URL urlsession_PHP

Source: Internet
Author: User
Transmits session information based on the URL of the website address. the URL of the website is urlsession. The session information is transmitted based on the URL of the website address. the URL of the website address is often used in php learning. today, let's talk about the session in detail; one is to transmit session information based on the URL of the website address urlsession

InPhpIn learning, sessions are often used, so today we will discuss in detailSession;

I,Session working mechanism:
When the session is enabled, the server saves the session file on the server, and then saves the session id in the browser to obtain the corresponding session information;

II. the following is the focus of the article:URL-based transfer session
If the session is transmitted using the basic session method, the cookie in the user's browser will be used. Once the user closes the cookie, the session will not work! So next we will put the session id on the link address of the website, so that users are not afraid to close the cookie!

(Using simple user logon as an example,When cookies are enabled, they are transmitted using cookies. when cookies are disabled, they are transmitted using URLs.)

1. create a user logon page and add


SID: when the cookie is enabled, the output is empty.
SID: when the cookie is disabled, the current user's session information is output. the specific format is session_name = session_id;

2. create a logon page to determine whether a user is logged on;


Session_id () indicates that the sessoin file is found based on the id in the parameter. Note that session_id () must be before session_start ().

3. create an exit logon page


First, clear the session data of the current user, and then delete the session file of the current user.
This is a small case of url-based session transmission !!

This article is original to Wang yelou's personal blog. if you want to reprint it, please indicate the source:Wang yelou's personal blog http://www.ly89.cn/detail/28.html

In php learning, session is often used. today we will talk about session in detail; 1...

Related Article

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.