简体   繁体   中英

How to delete cookie with HttpOnly using PHP or JS

I have a cookie with these parameters:

Name:   workgroup_session_id
Content:    ""
Domain: agrobman1.tsi.lan
Path:   /
Send for:   Any kind of connection
Accessible to script:   No (HttpOnly)
Created:    Wednesday, November 4, 2015 at 9:31:58 AM
Expires:    When the browsing session ends

I have tried to delete the cookie using PHP using this code:

setcookie("workgroup_session_id", "\"\"", time() - 3600, "/", "agrobman1.tsi.lan", false, true);

But I am still unable to delete it. Does anyone know how to delete a cookie of this type using PHP or JS?

You cannot delete an HttpOnly cookie on the client-side with javascript, as this post points out. It has to be done on the server side, as Neta points out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM