1<! DOCTYPE html Public"-//w3c//dtd XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >234<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>5<title> Untitled Document </title>6 78 9<body>Ten<?PHP One Session_Start();//before you store user information in a PHP session, you must first start the session. A //Note: the Session_Start () function must precede the - $_session["UID"]= "123";//Store session information and use it to store the user name later. - the $_session["Name"]= "Zhang San"; - - Echo $_session["UID"]; - //first, session, second, cookie + - Session 1, stored in server 2, can hold any type of data 3, has a default expiration time of 15 minutes 4, each login will store a copy + A //Two, cookie 1, stored in the client 2, can only store string 3, the default permanent, you can set the expiration time 4, the customer can also save a copy at - //session Usage - //1, can record the status of the logged-in person - //2, can be used to transfer values between pages - ///3, can prevent users from skipping login - //4, login user name, shopping cart, process in - to?> +<form action= "hhcl.php" method= "POST" > -<div> Username: <input type= "text" name= "AAAA"/></div> the *<div> Password: <input type= "text" name= "pwd"/></div> $<div><input type= "Submit" value= "Login"/></div>Panax Notoginseng</form> -</body> the + A the<?PHP + Session_Start(); - $ $ $uid=$_post["AAAA"]; - - the //Cookie Storage Information - //setcookie ("UID", $uid);Wuyi Header("location:main.php"); the -<title> Untitled Document </title> Wu - About<body> $<?PHP - Session_Start(); - if(!Empty($_session["UID"])) - { A +}Else the { - Header($_session["UID"]); $ } the the Echo $_session["UID"]; the?> the -</body> in123
Session control sessions, cookies