session_start(), session_register(),session_unregister(),
session_is_registered(),session_destroy函数.
session_start():启用session机制,在需要用到session的程序文件的最开始调用它.
session_register():注册session变量
session_unregister(): 删除session变量(一个一个删除)
session_is_registered(): 判断session变量是否注册
session_distroy(): 销毁所有session变量(所有session变量销毁)
初始化session
实例1
*/
session_start();
//删除所有的session变量值
$_session=array();
if(isset($_cookie[session_name()]))
{
setcookie(session_name(),'',time()-42000,'/');
}
//注销所有的session
session_destroy();
/*
实例2
*/
session_start(); //初始化session
$a=5; //定义变量
session_register('a'); //注册session
session_decode("
print (session_is_registered('a')?$_session[a]:'not registered' ); //判断变量是否注册
/*
实例3
*/
/*初始化session*/
session_start();
$_session['login_ok']=true; //定义session值
$_session['nome']='sica'; //定义session值
$_session['inteiro']=34; //定义session值
$result=session_encode(); //对session值加密
echo $result; //输出结果
session_destroy(); //注销所有session值
/*
实例4
*/
session_start(); //初始化session
$_session['name']="yoursession"; //注册一个session变量
if(!isset($_session['initiated'])) //如果某个值没有被设定
{
session_regenerate_id(); //获取当前的session id
$_session['initiated']=true; //设定值为真
}
session_destroy(); //注销session
//实例5
session_start(); //初始化session
$_session['name']="yoursession"; //注册一个session变量
if(session_is_registered(name)) //进行判断
{
echo "指定的变量已经被注册为session
"; //输出内容
}
else
{
echo "指定的变量没有被注册为session
"; //输出相应结果
}
session_destroy(); //注销session
?>

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version
SublimeText3 Linux latest version

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

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
