How to get the values in the session in PHP

Source: Internet
Author: User
How do I get the values in the session in PHP?
After the login verification is complete, I save the message to the session and then jump to another interface, and find out in the other interface that no matter how you try, you can only get a value.


In the verification page I also output can get the value of the page after the jump how can not be

share to: more


------Solution--------------------
String is a simplexmlelement Object and is not a standard normal array item.
$newposition = (array) $position;
------Solution--------------------
You have to deal with the source of the garbled.
You only changed the code of the page, of course it is not!
Your page is GBK, and simplexmlelement Returns the result is Utf-8, garbled is normal
$_session[' position '] = Strval ($position); This is utf-8.
$_session[' position ' = iconv (' utf-8 ', ' GBK ', Strval ($position)); This is the GBK.

The principle of writing and debugging a program is to reduce the problem to a small extent as much as possible (so that it is easy to solve the problem) rather than let the problem spread.

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