本文介紹了你如何在 PHP 中更新 cookie?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
如果我用相同的 cookie 名稱調用 setcookie()
兩次,我會創建兩個 cookie.
If I call setcookie()
two times with the same cookie name, I get two cookies created.
如何更新現有的 cookie?
How do you update an existing cookie?
推薦答案
您不能更新 cookie 本身,但是您可以覆蓋它.否則,這就是您要查找的內容:http://php.net/manual/en/function.setcookie.php
You can't update a cookie per se, you can however overwrite it. Otherwise, this is what you are looking for: http://php.net/manual/en/function.setcookie.php
它有效.請務必閱讀常見陷阱";來自那個頁面.
It works. Be sure to read "Common Pitfalls" from that page.
您也可以使用超級全局的 $_COOKIE['cookie_name']
來讀取 cookie.
You can use the super global $_COOKIE['cookie_name']
as well to read cookies.
這篇關于你如何在 PHP 中更新 cookie?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!