How does one obtain the value in the session in php? After login verification is complete, I save the information to the session, and then jump to another interface. when I de-value the other interface, I find that no matter how I try to get one value. On the verification page, I also output a value that can be obtained. how can the page after the jump fail? how can I obtain the value in the session in php?
After login verification is complete, I save the information to the session, and then jump to another interface. when I de-value the other interface, I find that no matter how I try to get one value.
On the verification page, I also output a value that can be obtained. how can this problem be solved on the page after the jump?
Share: More
------ Solution --------------------
String is a SimpleXMLElement Object and is not a standard normal array item.
$ Newposition = (array) $ position;
------ Solution --------------------
You need to handle the garbled source
You only changed the page encoding. of course not!
Your page is gbk, while SimpleXMLElement returns UTF-8, which is normal when garbled.
$ _ SESSION ['position'] = strval ($ position); // UTF-8
$ _ SESSION ['position'] = iconv ('utf-8', 'gbk', strval ($ position); // This is gbk.
The principle of program writing and debugging is to try to narrow down the problem to a small scope (so as to facilitate the problem solving) rather than let the problem spread out.