1.初始化(使用session前都要使用,一个页面用一个就可以了)
session_start();
2.保存
$_SESSION[$sessionName]=$value;
(value可以是double,bool,int,数组,object类型的数据)
例子:
$_SESSION['LoginUser']="zs";
3.取出指定
例子:
$uName=$_SESSION['LoginUser'];
4.删除指定
例子:
unset($_SESSION['LoginUser']);
5.删除全部session(删除当前浏览器对应的session文件)
session_destroy();
6.获取session_id
$session_id=session_id();
$session_id=SID; //常量
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn