当前位置:网站首页>PHP Basics - session control - Session
PHP Basics - session control - Session
2022-07-24 09:24:00 【Chon.Wang】
1. What is? session
sessionUsed to store user session information , The main function is to identify the current user interaction information .
sessionThe working mechanism is : Create a unique for each visitorsessionid, Stored in cookie in Or throughURL rewriteTo pass .
2. establish session
<?php
# establish session Before , You need to start the session first
session_start();
# establish session
$_SESSION['uuid'] = 'AI329D2828SD92JF01';
3. obtain session
<?php
if (isset($_SESSION['uuid'])) {
$uuid = $_SESSION['uuid']; # Get the name defined above as uuid Of session
}
4. Delete session
<?php
# Delete the specified session
if (isset($_SESSION['uuid'])) {
unset($_SESSION['uuid']); # Use unset To delete
}
# Delete all session( Reset session)
session_destroy();
5. Browser disable cookie after , How to use session
The first one is : adopt url Pass value
# adopt url rewrite
https://www.baidu.com?sessid=123456
The second kind : By hiding the form or ajax Pass value
<!-- html Hide form -->
<form name='testSID' action='/???'>
<input type='hidden' name='sessid' value='123456'>
</form>
// ajax Pass value , What we use here is jq
$.post("/???", {
sessid: 123456}, function (res) {
});
The third kind of : modify php.ini Medium use_trans_sid
take
php.iniMediumuse_trans_sid=0It is amended as followsuse_trans_sid=1, It will check whether the client is disabled cookie, If you disable , By defaultThe first one is : adopt url Pass valueWay to deliversessionid
边栏推荐
- 详解LinkedList
- Detailed LinkedList
- Map processing background management menu data
- Code random notes_ Linked list_ Turn over the linked list in groups of 25K
- Vim: extend the semantic analysis function of YCM for the third-party library of C language
- Gin framework uses session and redis to realize distributed session & Gorm operation mysql
- SDUT compilation principle experimental code
- Nuxt 路由切换后 asyncData 跨域报错
- 来阿里一年后我迎来了第一次工作变动....
- Racecar multi-point navigation experiment based on ROS communication mechanism
猜你喜欢

Aruba学习笔记06-无线控制AC基础配置(CLI)

FreeRTOS - use of software timer

Build practical product help documents to improve user satisfaction

C#/VB. Net: convert word or EXCEL documents to text

链表——24. 两两交换链表中的节点

Tiflash source code reading (V) deltatree storage engine design and implementation analysis - Part 2
![[don't bother to strengthen learning] video notes (III) 3. SARS (lambda)](/img/3b/981bd564a5855a317ccdd4800871ce.png)
[don't bother to strengthen learning] video notes (III) 3. SARS (lambda)

Understanding of magnetic parameters in Hall sensors

Description of MATLAB functions

The next stop of data visualization platform | gifts from domestic open source data visualization datart "super iron powder"
随机推荐
[Luogu p5410] [template] extend KMP (Z function) (string)
链表——24. 两两交换链表中的节点
财务数字化转型
Six pictures show you why TCP shakes three times?
Code random notes_ Linked list_ Turn over the linked list in groups of 25K
Tiflash source code reading (V) deltatree storage engine design and implementation analysis - Part 2
如何通过NFT GO,来简要判断、分析NFT市场?
From single architecture to distributed architecture, there are many pits and bugs!
Detailed explanation of the whole process of R & D demand splitting | agile practice
来阿里一年后我迎来了第一次工作变动....
Foreign lead operation takes one month to collect money, and the sideline still needs it
Wenxin big model raises a new "sail", and the tide of industrial application has arrived
TiFlash 源码阅读(五) DeltaTree 存储引擎设计及实现分析 - Part 2
[assembly language practice] (II). Write a program to calculate the value of expression w=v- (x+y+z-51) (including code and process screenshots)
[note] what is kernel / user space? Let's start with how the CPU runs the program
The difference between classification and regression
【汇编语言实战】(二)、编写一程序计算表达式w=v-(x+y+z-51)的值(含代码、过程截图)
Onpropertychange property
SQL 优化原则
唐宇迪opencv-背景建模