<? PHP // ======================================================== ================================ cookie // $ cookievalue = 'cookievalue '; // two methods can be used to create a cookie // 1, // setcookie ("cookiename", $ cookievalue, time () + 600, "/T12/F1/F11 /"); // 2, // header ("Set-COOKIE: cookiename = $ cookievalue; expire = ". (Time () + 100 ). "; Path =/T12/F1/F11/"); // The first parameter is the cookie name. The setcookie method is only required for the cookie name, other optional parameters: // The second parameter is the cookie value // The validity period of the third cookie. Unit: Second // The fourth parameter path specifies the folder in which the page sets the cookie, by default, the folder where the current page is located // a cookie file can contain many cookie elements // if the path is not written, or an empty string, the cookie file of the current folder is generated by default, the cookie file name is "Name of the folder where the current access page is located +/" // path. To generate a cookie for a specified folder, the path must be "/+ absolute path of the folder" or "/+ absolute path of the folder + /", the maximum folder name is the folder name of the project. // the current page can access the values in the cookie files generated by the folder and all its parent folders, however, you cannot access the cookies generated by all subfolders in the folder. // echo $ _ cookie ["cookiename"]; // clear the cookie // setcookie ("cookiename ", ""); // or // setcookie ("cookiename", "", time ()-1 ); // ================================================ ================================== session // start session, run this method session_start () before outputting the page with $ _ session [] global variables; // set session $ _ session ['sessionname'] = "sessionvalue "; // use sessionecho $ _ session ['sessionname']; // destroy a session in three steps. session_destroy (); setcookie (session_name (), '', time () -3600); $ _ session = array ();