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

What about the failure of setcookie in php

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

Share

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

This article mainly introduces the php setcookie failure how to do, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

1. Open cookie in the browser.

2. Delete any HTTP header output before setcookie ().

3. Use setcookie () of php to create a cookie.

Use php's setcookie () to create a cookie, just like session_start () with session turned on in php, there can be no HTTP header output before setcookie (). I went to check the code and found the following code

Var_dump ($qOpenId); setcookie ('qOpenId',$openid,time () + 30 * 24 * 3600)

Decisively comment on the line var_dump ($OpenId), test, successful.

Personally, setcookie should directly set the contents of http header, so there can not be any header output, var_dump,echo and so on.

Thank you for reading this article carefully. I hope the article "what to do about setcookie failure in php" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you 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