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 solve the problem of php failed to clear cookie

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article focuses on "how to solve the problem of php clearing cookie failure", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to solve the problem of php clearing cookie failure".

Php failed to clear cookie because the path parameter of cookie does not correspond to each other. The solution is to change the deletion code to "setcookie ($key,", time ()-36000).

This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer

What if php fails to clear cookie?

Reason why php cookie cannot be deleted

Cookie can be deleted through setcookie (name, value, expiration, path, host, secure, httponly)

If the cookie name is guaranteed to be the same and cannot be deleted, it means that the path parameter of cookie does not correspond to the result.

For example, if you are setting up cookie, this is it.

Setcookie ($key,$value,time () + 36000 fuzz')

Then when deleting, it must be like this.

Setcookie ($key, "", time ()-36000 jigsaw marks')

The slash after it means path, which must be consistent.

At this point, I believe you have a deeper understanding of "how to solve the problem of php clearing cookie failure". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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