当前位置:网站首页>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
边栏推荐
- (5) Cloud integrated gateway gateway +swagger documentation tool
- Vim: extend the semantic analysis function of YCM for the third-party library of C language
- Cloud primordial (12) | introduction to kubernetes foundation of kubernetes chapter
- [don't bother to strengthen learning] video notes (IV) 1. What is dqn?
- Dorissql syntax Usage Summary
- JS locate Daquan to get the brother, parent and child elements of the node, including robot instances
- Racecar multi-point navigation experiment based on ROS communication mechanism
- Scheme and software analysis of dual computer hot standby system "suggestions collection"
- How can tiktok transport videos not be streaming limited?
- Hands on deep learning (VII) -- bounding box and anchor box
猜你喜欢
Gin framework uses session and redis to realize distributed session & Gorm operation mysql
![[don't bother to strengthen learning] video notes (IV) 1. What is dqn?](/img/74/51219a19595f93e7a85449f54d354d.png)
[don't bother to strengthen learning] video notes (IV) 1. What is dqn?
![[don't bother with intensive learning] video notes (III) 1. What is SARS?](/img/5c/4636db2849ba8514976a5afaf56e38.png)
[don't bother with intensive learning] video notes (III) 1. What is SARS?

RxJS Beginner Guide

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

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

DP longest common subsequence detailed version (LCS)

Aruba learning notes 06 wireless control AC basic configuration (CLI)

数据中台:始于阿里,兴于DaaS

Racecar multi-point navigation experiment based on ROS communication mechanism
随机推荐
[Luogu p5410] [template] extend KMP (Z function) (string)
[don't bother to strengthen learning] video notes (III) 2. SARS learning realizes maze walking
Android system security - 5.2-apk V1 signature introduction
How to judge and analyze NFT market briefly through NFT go?
Xtrabackup realizes full backup and incremental backup of MySQL
财务数字化转型
科目1-3
TiFlash 源码阅读(五) DeltaTree 存储引擎设计及实现分析 - Part 2
Hands on deep learning (VII) -- bounding box and anchor box
NVIDIA set persistent mode
Aruba学习笔记06-无线控制AC基础配置(CLI)
Linked list - 24. Exchange nodes in the linked list in pairs
Detailed sequence traversal of leetcode102 binary tree
Replace the function of pow with two-dimensional array (solve the time overrun caused by POW)
SQL optimization principles
Detailed explanation of the whole process of R & D demand splitting | agile practice
[note] what is kernel / user space? Let's start with how the CPU runs the program
Tiflash source code reading (V) deltatree storage engine design and implementation analysis - Part 2
Detailed LinkedList
Makefile variables and dynamic library static library