PHP WeChat Public development platform how to use session

Source: Internet
Author: User
Tags send cookies
Session is stored on the server side, then each user's session will need to use the client's cookie, the server does not send cookies to the developer server, so the cookie-based session can not be used.

However, the same effect can be achieved as long as a unique session_id is set for each user.

Each person number is unique, so we can use the number as the user's session_id, or it can be MD5 encrypted after use.

Set Tousername to session_id as follows

  $POSTSTR = $GLOBALS ["Http_raw_post_data"];  if (!empty ($POSTSTR)) {      $msg = (array) simplexml_load_string ($postStr, ' simplexmlelement ', libxml_nocdata);      $POSTSTR = $GLOBALS ["Http_raw_post_data"];  if (!empty ($POSTSTR)) {              $msg = (array) simplexml_load_string ($postStr, ' simplexmlelement ', libxml_nocdata);      Set session_id      session_id ($msg [' tousername ']);      Session_Start ();  }

The above introduces the PHP public development platform How to use the session, including aspects of the content, I hope that the PHP tutorial interested in a friend to help.

  • Related Article

    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.