定義和用法
session_cache_expire - 回傳當前快取的到期時間
語法
session_cache_expire ( [ string $new_cache_expire ] )
session_cache_expire() 回傳 session.cache_expire 的設定值,請求開始的時候,快取到期時間會被重置為 180,并且保存在 session.cache_expire 配置項中, 因此,針對每個請求,需要在 session_start() 函式呼叫之前 呼叫 session_cache_expire() 來設定快取到期時間,
引數
| 引數 | 必需的 | 描述 |
|---|---|---|
| new_cache_expire | 否 | 如果給定 new_cache_expire ,就使用 new_cache_expire 的值設定當前快取到期時間,
注意: 僅在 session.cache_limiter 的設定值 不是 nocache 的時候, 才可以設定 new_cache_expire 引數, |
回傳值
回傳 session.cache_expire 的當前設定值, 以分鐘為單位,默認值是 180 (分鐘),
示例
/* 設定快取限制為 “private” */
session_cache_limiter('private');
$cache_limiter = session_cache_limiter();
/* 設定快取過期時間為 30 分鐘 */
session_cache_expire(30);
$cache_expire = session_cache_expire();
/* 開始會話 */
session_start();
echo "The cache limiter is now set to $cache_limiter<br />";
echo "The cached session pages expire after $cache_expire minutes";
相關函式
session_cache_limiter() - 讀取/設定快取限制器
session_regenerate_id() - 使用新生成的會話 ID 更新現有會話 ID
session_start() - 啟動新會話或者重用現有會話
SessionHandler::create_sid() - 回傳一個新的會話ID
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/66501.html
標籤:PHP
上一篇:數字顛倒
