<?php header('Content-Type: text/html; charset=utf-8'); // start a new session or reuse an existing session session_start(); //Configure Seeeion $_SESSION['data'] = array('user'=>'chaoyi','website'=>'onestopweb.iteye.com'); //Use Session print_r($_SESSION['data']); echo $_SESSION['data']['user']; // Determine if a Session exists echo isset($_SESSION['data']) ? 'exists' : 'does not exist'; //Destroy the specified variable unset($_SESSION['data']); //Release all $_SESSION variables currently created in memory, but do not delete the session file and do not release the corresponding sessionid session_unset(); //Delete the session file corresponding to the current user and release the sessionid, the contents of the $_SESSION variable in the memory are still retained session_destroy(); echo isset($_SESSION['data']) ? 'exists' : 'does not exist';
Effect picture: