The session exists in Memcache, and when Session_Start () is called again, no data is read.

Source: Internet
Author: User
Using the Session_set_save_handler to present the session in Memcache
Then you want to restart the session and find that the data is not read.
When the session exists in file, the data can be read when the Session_Start () is called again.
But not in the memcache (of course, from the memcache can be obtained)

Question 1: Can I read the session data in Memcache by reusing existing sessions?
Question 2:session_start () How do I load data when I reuse an existing session?

Reply content:

Using the Session_set_save_handler to present the session in Memcache
Then you want to restart the session and find that the data is not read.
When the session exists in file, the data can be read when the Session_Start () is called again.
But not in the memcache (of course, from the memcache can be obtained)

Question 1: Can I read the session data in Memcache by reusing existing sessions?
Question 2:session_start () How do I load data when I reuse an existing session?

Session_Start () creates a new session or reuses existing sessions. If you submit a session ID by either a GET or POST, or by using a cookie, the existing session is reused.
http://php.net/manual/zh/function.session-start.php

The simplest way to do this is php.ini can be set directly

Method I: Global settings in php.ini

session.save_handler = memcachesession.save_path = "tcp://127.0.0.1:11211"

Method II:. htaccess in a directory:

php_value session.save_handler "memcache"php_value session.save_path  "tcp://127.0.0.1:11211"

Method III: Again or in one application:

ini_set("session.save_handler", "memcache");ini_set("session.save_path", "tcp://127.0.0.1:11211");

I guess the landlord is the code to write a problem

  • 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.