标签:内存 min use script 释放 bsp start rip set
<?php //设置cookie setcookie("username","admin",time()+3600); //设置cookie数组 setcookie("user[‘id‘]",1,time()+36000); setcookie("user[‘username‘]","user1",time()+36000); //读取cookie数据要跳转,为了刷新数据 echo "<script>window.location.href=‘./getcookie.php‘</script>"; //getcookie.php代码,销毁cookie和输出cookie setcookie("username",‘‘,time()-1); echo $_COOKIE[‘username‘]; ?> <?php session_start(); //首先要开启session $_SESSION[‘username‘] = ‘admin1‘; //设置session echo $_SESSION[‘username‘]; //输出session的值 //设置session数组 $user = array("id"=>1,"username"=>"user1","sex"=>"男","age"=>20); $_SESSION[‘user‘] = $user; echo $_SESSION[‘user‘][‘username‘]; //输出session的值 //销毁session session_destroy(); //删除服务器中的文件 $_SESSION[‘user‘] = array(); //清空user的session,从内存中释放 unset($_SESSION[‘user‘]); //这个连下标都给释放 ?>
标签:内存 min use script 释放 bsp start rip set
原文地址:http://www.cnblogs.com/htmlphp/p/6371514.html