Cookie-PHPSESSION reading problem, why is it always reported that the session has been enabled-php Tutorial

Source: Internet
Author: User
{Code ...}

  

Reply content:

   

Session_start (); // is it added?

The code you posted is not the original code, right?

Whether you have enabled the session or not$_SESSION[$key]If the value is assigned, it will not appear.undefined index

I guess this problem is mainly because session_id is not passed after the header jump. you can check these items:

1. whether the cookie is disabled on the client. if disabled, manually pass session_id or enable session with the header. use_trans_sid2. session_start () must be prior to any header () 3. whether session_start () is enabled for the jump target ()

Running properly, stamp demo

Add session_start ();

I used more Frameworks. haha.
Many frameworks are enabled by default.

I have read the problem that the reply key is a variable.
This variable does not exist.

That is to say, the session cannot store the value? Are you sure the disk (if any) is not full?

Set $ _ SESSION [$ key] = $ id;
Read now: var_dump ($ _ SESSION [$ key]); check to see if this works;

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.