Does Session have to rely on Cookie_PHP Tutorial
Does Session have to rely on Cookie?
www.ouryh.net Galaxy Technology OnlineㄕCompilation time: 2001-8-7ㄕAuthor: UnknownㄕSource: UnknownㄕReads: 36
Session in PHP can be defaulted In this case, the client's Cookie (to distinguish it from Cookie in the ordinary sense, I call it session cookie, and Cookie in the ordinary sense is Cookie) is used to save the session id, but can sessions in PHP only use session cookies? ?Of course not, otherwise why bother to create a session? It is better to just use Cookie. One of the great advantages of Session is that when the client's Cookie is disabled, the session id will be automatically attached to the URL, so that it can be remembered through the session id. The session variable is stored.
I will write two files below to confirm. First, disable cookies in the browser.
//The file name is test1.php
session_start();
session_register("url");
$url="test2.php";
echo "goto test2.php
";
? >
//The file name is test2.php
session_start();
if (session_is_registered("url")) {
echo "Congratulations.
";
$url="test1.php";
echo "goto test1.php
";
}
else echo "Failed.
";
?>
Now enter "http://localhost/test1.php" in the browser, move the mouse over the link and look at the address on the status bar. It is not a simple "http: //localhost/test2.php", but in this form: "http://localhost/test2.php?PHPSESSID=6e3610749f7ded3784bc4a4dd10f879b". You can also view the Html source file, which is in this form:
goto test2.php
So this is entirely the result of PHP and has nothing to do with the browser, that is to say, no matter what browser you use It is valid for all sessions, not only for IE as some people think.
However, our hyperlink statement is output by the echo statement. If the hyperlink is not included in the PHP tag ?> What will happen? Let’s write an example to verify it. Modify test1.php slightly:
session_start();
session_register("url");
$url= "test2.php";
echo "goto test2.php
";
?>
(Html form)goto test2.php

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Session failure is usually caused by the session lifetime expiration or server shutdown. The solutions: 1. Extend the lifetime of the session; 2. Use persistent storage; 3. Use cookies; 4. Update the session asynchronously; 5. Use session management middleware.

Cookies on your computer are stored in specific locations on your browser, depending on the browser and operating system used: 1. Google Chrome, stored in C:\Users\YourUsername\AppData\Local\Google\Chrome\User Data\Default \Cookies etc.

Cookies are usually stored in the cookie folder of the browser. Cookie files in the browser are usually stored in binary or SQLite format. If you open the cookie file directly, you may see some garbled or unreadable content, so it is best to use Use the cookie management interface provided by your browser to view and manage cookies.

Solution to the cross-domain problem of PHPSession In the development of front-end and back-end separation, cross-domain requests have become the norm. When dealing with cross-domain issues, we usually involve the use and management of sessions. However, due to browser origin policy restrictions, sessions cannot be shared by default across domains. In order to solve this problem, we need to use some techniques and methods to achieve cross-domain sharing of sessions. 1. The most common use of cookies to share sessions across domains

Cookies on the mobile phone are stored in the browser application of the mobile device: 1. On iOS devices, Cookies are stored in Settings -> Safari -> Advanced -> Website Data of the Safari browser; 2. On Android devices, Cookies Stored in Settings -> Site settings -> Cookies of Chrome browser, etc.

LINUX is a widely used operating system that is highly customizable and stable. CentOS is a free and open source operating system built on the Red Hat Enterprise Linux (RHEL) source code. It is widely used in servers and desktop environments. In CentOS Installing software packages on CentOS is one of the common tasks in daily use. This article will introduce how to install gnuplot on CentOS and solve the problem of missing dependencies of Sunflower software. Gnuplot is a powerful drawing tool that can generate various types of charts, including two-dimensional and three-dimensional data visualization. To install gnuplot on CentOS, you can follow the steps below: 1.

The dangers of cookie leakage include theft of personal identity information, tracking of personal online behavior, and account theft. Detailed introduction: 1. Personal identity information is stolen, such as name, email address, phone number, etc. This information may be used by criminals to carry out identity theft, fraud and other illegal activities; 2. Personal online behavior is tracked and analyzed through cookies With the data in the account, criminals can learn about the user's browsing history, shopping preferences, hobbies, etc.; 3. The account is stolen, bypassing login verification, directly accessing the user's account, etc.

With the popularity of the Internet, we use browsers to surf the Internet have become a way of life. In the daily use of browsers, we often encounter situations where we need to enter account passwords, such as online shopping, social networking, emails, etc. This information needs to be recorded by the browser so that it does not need to be entered again the next time you visit. This is when cookies come in handy. What are cookies? Cookie refers to a small data file sent by the server to the user's browser and stored locally. It contains user behavior of some websites.
