Current Location: Home> Function Categories> session_cache_expire

session_cache_expire

Return to the current cache expiration
Name:session_cache_expire
Category:Session Session
Programming Language:php
One-line Description:Get or set the cache expiration time for the current session

Function name: session_cache_expire()

Function description: session_cache_expire() is used to get or set the cache expiration time of the current session.

Function parameters: None

Return value: If a new cache expiration time is set, the previous cache expiration time is returned; if a new cache expiration time is not set, the current cache expiration time is returned.

Applicable version: PHP 4.2.0 and above

Usage example:

  1. Get the cache expiration time of the current session:
 $cacheExpire = session_cache_expire(); echo "当前会话的缓存过期时间为:{$cacheExpire} 分钟";
  1. Set the new cache expiration time to 60 minutes and return the previous cache expiration time:
 $previousExpire = session_cache_expire(60); echo "先前的缓存过期时间为:{$previousExpire} 分钟";

Notes:

  • The session_cache_expire() function can only be called before session_start().
  • The cache expiration time is an integer in minutes. If the setting time is less than or equal to 0, the session cache will never expire.
  • The cache expiration time only affects the session cache, not the browser cache.
Similar Functions
Popular Articles