当前位置:网站首页>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
边栏推荐
- Android system security - 5.2-apk V1 signature introduction
- Leetcode94-二叉树的中序遍历详解
- What is the component customization event we are talking about?
- Let's test 5million pieces of data. How to use index acceleration reasonably?
- UE5影视动画渲染MRQ分层学习笔记
- 我们说的组件自定义事件到底是什么?
- Protocol buffers 的问题和滥用
- Read write lock, shared lock, exclusive lock
- TiFlash 源码阅读(五) DeltaTree 存储引擎设计及实现分析 - Part 2
- [MySQL] - deep understanding of index
猜你喜欢
![[assembly language practice] (II). Write a program to calculate the value of expression w=v- (x+y+z-51) (including code and process screenshots)](/img/0d/c8042ce5019d7dc5414dde5ebf1e8d.jpg)
[assembly language practice] (II). Write a program to calculate the value of expression w=v- (x+y+z-51) (including code and process screenshots)
![[MySQL] - deep understanding of index](/img/a6/6ca1356fe11bd33ec7362ce7cdc652.png)
[MySQL] - deep understanding of index

Tang Yudi opencv background modeling

Why is TCP a triple handshake

Leetcode94-二叉树的中序遍历详解

【基于ROS的URDF练习实例】四轮机器人与摄像头的使用

Re6: reading paper licin: a heterogeneous graph based approach for automatic legal stat identification fro

链表——24. 两两交换链表中的节点
![[don't bother to strengthen learning] video notes (III) 2. SARS learning realizes maze walking](/img/a8/0d3bd3cc2b3e1d43e201e5dfe4b729.png)
[don't bother to strengthen learning] video notes (III) 2. SARS learning realizes maze walking
![[translation] integration challenges in microservice architecture using grpc and rest](/img/88/53f4c2061b538b3201475ba51449ff.jpg)
[translation] integration challenges in microservice architecture using grpc and rest
随机推荐
Detailed explanation of the whole process of R & D demand splitting | agile practice
[don't bother with reinforcement learning] video notes (I) 2. Summary of reinforcement learning methods
CUDA day 2: GPU core and Sm core components [easy to understand]
web安全入门-开源防火墙Pfsense安装配置
华为无线设备安全策略配置命令
SDUT compilation principle experimental code
Android系统安全 — 5.3-APK V2签名介绍
Opencv learning Day5
NVIDIA set persistent mode
With 8 years of product experience, I have summarized these practical experience of continuous and efficient research and development
Nuggets manufacturing industry, digital commerce cloud supply chain collaborative management system to achieve full chain intelligent management and control
分类与回归的区别
Protocol buffers 的问题和滥用
代码随想录笔记_链表_25K个一组翻转链表
Tiktok live broadcast with goods marketing play
Android system security - 5.3-apk V2 signature introduction
How to improve office efficiency through online collaborative documents
排序入门—插入排序和希尔排序
The next stop of data visualization platform | gifts from domestic open source data visualization datart "super iron powder"
Wenxin big model raises a new "sail", and the tide of industrial application has arrived