Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deal with Session lost value after PHP Jump

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to deal with the lost value of Session after PHP jump, and the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

.... Key = get_qq_token ($_ GET ["code"], $_ GET ["state"], $_ SESSION ["URI"]); if ($key ['access_token']! = = false) {$_ SESSION [' qq_keys'] = $key; $me = get_qq_user_info ($key ['access_token'], $key [' openid']);}.

I found the method called after setting session to fetch user information, which uses the curl function class of php to make a request to the specified url. Then I began to wonder "whether the value of session has been disposed of here, and I don't know if the curl_close method will empty the current session value." as mentioned earlier, I don't know why, but this doubt did help me solve the problem, so I postponed the session setting until after the calling method, that is,

$me = get_qq_user_info ($key ['access_token'], $key [' openid']); $_ SESSION ['qq_keys'] = $key

As a result, the problem is really solved, and the session is passed to the jump page normally. I don't know why, but you might want to remember a trick: session is set after the curl request, and interspersing the curl request will cause the session to be lost.

How to deal with the lost value of Session after PHP jump is shared here. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report