What about the failure of setcookie in php
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!