Correct logoff of PHP SESSION, logoff phpsession_php tutorial

Source: Internet
Author: User

Correct logoff of PHP SESSION, logoff phpsession


/*1, each page must be opened session_start () to use the session in each page. 2, Session_Start () initialization session, the first access will generate a unique session ID is saved on the client (is based on cookie), the next time the user accesses, Session_Start () will check that there is no session ID, If there is a browser with this session ID (sent through the sending header file, which can be seen in the FF browser) to determine the client. 3, the session to the cookie will be stored in the client a conversation ID is session_id, this can be seen by printing a cookie, the session_id key value is session_name,session_id () = = $_ Cookie[session_name ()]4, if the client has disabled cookies, the URL must be passed session_id that the URL is given SESSION5, logoff session cannot use Unset ($_session), you can use $_ Session = Array () or $_session = null, the correct way to unregister the session is as follows: *///correct logoff session method://1 open Sessionsession_start ();//2, Empty SESSION Information $_session = Array ();//3, clear Client Sessionidif (Isset ($_cookie[session_name ())) {    Setcookie (session_name (), ", Time ()-3600, '/');} 4. Complete destruction of Sessionsession_destroy ();

  

http://www.bkjia.com/PHPjc/983247.html www.bkjia.com true http://www.bkjia.com/PHPjc/983247.html techarticle The correct logoff php session, logoff phpsession/*1, each page must be open session_start () to use the SESSION in each page. 2, Session_Start () initialization session, first ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.