当前位置:网站首页>PHP Basics - session control - cookies
PHP Basics - session control - cookies
2022-07-24 09:24:00 【Chon.Wang】
1. What is? cookie ?
CookieIt is a mechanism to store data in the remote browser side to track and identify users .
2. establish cookie
<?php
# setcookie(name, value, expire, path, domain);
setcookie('user_name', 'Chon', 7200);
nameyes cookie Name identification . It's necessary
valueyes cookie Initial value . It's necessary
expireUsed for setting up cookie The validity of the . Optional
pathUsed for setting up cookie The relevant path of . Optional
domainUsed to set the effect on cookie The website of . Optional
3. obtain cookie
<?php
# Use $_COOKIE Global variables get
if (isset($_COOKIE['user_name'])) {
$user_name = $_COOKIE['user_name']; # Get the name defined above as user_name Of cookie
}
4. Delete cookie
<?php
setcookie('user_name', ''); # Set to null
setcookie('user_name', '', time()-3600); # Set to past time
边栏推荐
- OPENCV学习DAY5
- 财务数字化转型
- js定位大全获取节点的兄弟,父级,子级元素含robot实例
- [don't bother to strengthen learning] video notes (IV) 1. What is dqn?
- DP longest common subsequence detailed version (LCS)
- What does CRM mean? Three "key points" for CRM management software selection
- Cess test online line! The first decentralized storage network to provide multiple application scenarios
- Six pictures show you why TCP shakes three times?
- Tang Yudi opencv background modeling
- MySQL基础篇(一)-- SQL基础
猜你喜欢

云原生(十二) | Kubernetes篇之Kubernetes基础入门

Build practical product help documents to improve user satisfaction

Detailed sequence traversal of leetcode102 binary tree

代码随想录笔记_链表_25K个一组翻转链表

Gnuplot software learning notes

详解LinkedList

TCP triple handshake connection combing

Let's test 5million pieces of data. How to use index acceleration reasonably?

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

Assignment operator (geritilent software - Jiuye training)
随机推荐
The difference between & &, | and |
C#/VB. Net: convert word or EXCEL documents to text
Account 1-2
Introduction to common ansible modules
力扣300-最长递增子序列——动态规划
How do tiktok merchants bind the accounts of talents?
Little dolphin "transformed" into a new intelligent scheduling engine, which can be explained in simple terms in the practical development and application of DDS
SDUT compilation principle experimental code
& 和 &&、| 和 || 的区别
Aruba learning notes 06 wireless control AC basic configuration (CLI)
[don't bother with reinforcement learning] video notes (I) 3. Why use reinforcement learning?
Firewall off and on command
财务数字化转型
(5) Cloud integrated gateway gateway +swagger documentation tool
Vector control of permanent magnet synchronous motor (I) -- mathematical model
Description of MATLAB functions
Promise基础总结
Scarcity in Web3: how to become a winner in a decentralized world
We were tossed all night by a Kong performance bug
Leetcode94-二叉树的中序遍历详解