session

英 [?se?n]? ?美 [?s???n]??

n.開會,會議;(法庭的)開庭;會期,學(xué)期;(進(jìn)行某活動連續(xù)的)一段時(shí)間

cache

英 [k??]? ?美 [k??]??

n.藏物處;隱藏處;藏匿的珍寶;<電腦>快速緩沖貯存區(qū)

vt.貯藏

vi.躲藏

php session_cache_expire()函數(shù) 語法

作用:返回當(dāng)前緩存的到期時(shí)間

語法:int?session_cache_expire?([?string?$new_cache_expire?] )

參數(shù):

參數(shù)描述
new_cache_expire? ?如果給定?new_cache_expire?,就使用?new_cache_expire?的值設(shè)置當(dāng)前緩存到期時(shí)間。

說明:session_cache_expire()?返回?session.cache_expire?的設(shè)定值。請求開始的時(shí)候,緩存到期時(shí)間會被重置為 180,并且保存在?session.cache_expire?配置項(xiàng)中。 因此,針對每個(gè)請求,需要在?session_start()?函數(shù)調(diào)用之前 調(diào)用?session_cache_expire()?來設(shè)置緩存到期時(shí)間。

php session_cache_expire()函數(shù) 示例

<?php
/* 設(shè)置緩存限制為 “private” */
session_cache_limiter('private');
$cache_limiter = session_cache_limiter();
/* 設(shè)置緩存過期時(shí)間為 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";
?>

運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例

輸出:

The cache limiter is now set to private
The cached session pages expire after 30 minutes