Why can't the value of the SESSION variable be obtained? How to solve

Source: Internet
Author: User
Why can't the value of the SESSION variable be obtained? On the registration SESSION variable page, enter $ username & nbsp ;=& nbsp; $ HTTP_POST_VARS [& quot; username & quot;]; session_register (& quot; username & quot;); why can't the value of the SESSION variable be obtained?
The registration SESSION variable page is written as follows:
$ Username = $ HTTP_POST_VARS ["username"];
Session_register ("username ");

On another page, make the following judgment:
If (! Isset ($ _ SESSION ["username"]) | $ _ SESSION ["username"] = "")
{
Print ("username unregistered!
");
Print ("Login
");
Die ();
}
Else print ("username is registered!
");


$ HTTP_POST_VARS ["username"] already has a value, but what is printed on the judgment page is username unregistered !, Why?

PHP version 4.3.9. is it necessary to modify the PHP configuration file?

------ Solution --------------------
Session_start ();
$ Username = $ HTTP_POST_VARS ["username"];
$ _ SESSION ['username'] = $ username;
------ Solution --------------------
Session_start?
------ Solution --------------------
$ Username = $ HTTP_POST_VARS ["username"];
Session_register ("username ");

==>
$ _ SESSION ["username"] = $ username;
------ Solution --------------------
Is your PHP configuration question?

I have also encountered one time before, that is, when the blank merchant recovers the system, my session will be unusable,

It is not completely unavailable, that is, the initial Shard value before the period is effective, and the cross-region operation will not work.

After that, he just needs to reset it once again ..

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.