久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

設(shè)置 cookie 永不過期

Set a cookie to never expire(設(shè)置 cookie 永不過期)
本文介紹了設(shè)置 cookie 永不過期的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

查看 php 設(shè)置 cookie 文檔 我發(fā)現(xiàn)我可以設(shè)置 cookie 的過期日期.您可以將 cookie 設(shè)置為在瀏覽器會(huì)話結(jié)束時(shí)或?qū)砟硞€(gè)時(shí)間過期,但我沒有看到將 cookie 設(shè)置為永不過期的方法.這甚至可能嗎?這是如何實(shí)現(xiàn)的?

Looking at the php documentation on setting a cookie I see that I can set an expiration date for the cookie. You can set the cookie to expire at the end of the browser session or at some time in the future but I do not see a way to set the cookie to never expire. Is this even possible and how is this accomplished?

推薦答案

所有 cookie 根據(jù) 過期cookie 規(guī)范,所以這不是 PHP 限制.

All cookies expire as per the cookie specification, so this is not a PHP limitation.

使用遙遠(yuǎn)的未來日期.比如設(shè)置一個(gè)十年后過期的cookie:

Use a far future date. For example, set a cookie that expires in ten years:

setcookie(
  "CookieName",
  "CookieValue",
  time() + (10 * 365 * 24 * 60 * 60)
);

請(qǐng)注意,如果您在 32 位 PHP 中將日期設(shè)置為 2038,則該數(shù)字將環(huán)繞并且您將獲得一個(gè)立即過期的 cookie.

Note that if you set a date past 2038 in 32-bit PHP, the number will wrap around and you'll get a cookie that expires instantly.

這篇關(guān)于設(shè)置 cookie 永不過期的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個(gè)表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設(shè)置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數(shù)組自動(dòng)填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產(chǎn)生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 91精品欧美久久久久久久 | 欧美 日韩 国产 成人 在线 | 亚州综合一区 | 亚洲精品一区二区 | 国产欧美精品 | 成人免费福利视频 | 97热在线 | 日韩福利视频 | 亚洲一区二区三区乱码aⅴ 四虎在线视频 | 日韩三级在线观看 | 久久精品久久久久久 | 国产精品夜间视频香蕉 | 一区二区三区视频在线观看 | 国产精品久久久久久久久久久久 | 亚洲精品二三区 | 婷婷久久综合 | 在线免费观看成人 | 久久久婷| 欧美午夜精品久久久久免费视 | 欧美午夜影院 | 欧美a级成人淫片免费看 | 成年女人免费v片 | 拍戏被cao翻了h承欢 | 亚洲av毛片| www.47久久青青 | 国产激情亚洲 | av大片| 综合激情网 | 久久精品亚洲国产 | 国产午夜精品一区二区三区嫩草 | 欧美亚洲视频在线观看 | 99热这里| 国产激情视频网址 | 黄色免费观看 | 午夜免费| 91超碰在线观看 | 亚洲视频免费在线观看 | 正在播放国产精品 | 日韩一区二区免费视频 | 日韩精品一区二区不卡 | 精精国产xxxx视频在线播放 |