<?php /* session的销毁 */ @header('content-type:text/html;charset=utf-8'); session_start(); $_SESSION['username']='test1'; echo 'session没销毁时:'.$_SESSION['username']; echo "<br>"; //方法一 // $_SESSION['username']=null; //方法二 //session_unset(); //session_destroy(); //方法三 $_SESSION=array(); echo 'session销毁后:'.$_SESSION['username'];
The above introduces the three methods of destroying PHP sessions, including the relevant contents. I hope it will be helpful to friends who are interested in PHP tutorials.