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

The solution that session can't keep in php7

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Editor to share with you the php7 session can not maintain the solution, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

Php7 session can not maintain the solution: 1, open the corresponding PHP code file; 2, modify the use of the "session_set_save_handler" function.

This article operating environment: Windows7 system, PHP7.1 version, Dell G3 computer.

The impact of php upgrade to php7.x, session keep problems, keep login

Why can't you log in? the main reason is session.

A recent project uses php7.x, but the company's servers are 5.5 and 5.6, customer demand is above all else, the server upgrade to 7.2 will not be able to log in, the reason is unable to maintain the login status.

Because Wechat login is used, the debugging information can not be seen intuitively, so we can only add various terminals and write log text.

Finally, the hematemesis is that the session is not written properly, so that the session does not exist when the page is refreshed the second time.

By the way, this situation is suitable for session writing to the database, and it should not be affected if session is in the form of a file.

That is, to use this function session_set_save_handler, (although a professional background, but phper is a half-way monk, forgive my poor words, really do not know what the name of this form is, does not affect the development and do not bother to check), at the end of the read function, 5.x how many return false,7.x requires return', resulting in unable to write session

Without saying much about the above figure, those who often do project buckle code should be able to see which source code this is.

These are all the contents of this article entitled "Solutions that cannot be maintained by session in php7". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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

Development

Wechat

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

12
Report