首页 >函数列表 >session_cache_limiter

session_cache_limiter

session_cache_limiter

(PHP 4 >= 4.0.3, PHP 5)

session_cache_limiterGet and/or set the current cache limiter

说明

string session_cache_limiter ([ string $cache_limiter ] )

session_cache_limiter() returns the name of the current cache limiter.

The cache limiter defines which cache control HTTP headers are sent to the client. These headers determine the rules by which the page content may be cached by the client and intermediate proxies. Setting the cache limiter to nocache disallows any client/proxy caching. A value of public permits caching by proxies and the client, whereas private disallows caching by proxies and permits the client to cache the contents.

In private mode, the Expire header sent to the client may cause confusion for some browsers, including Mozilla. You can avoid this problem by using private_no_expire mode. The Expire header is never sent to the client in this mode.

The cache limiter is reset to the default value stored in session.cache_limiter at request startup time. Thus, you need to call session_cache_limiter() for every request (and before session_start() is called).

参数

cache_limiter

If cache_limiter is specified, the name of the current cache limiter is changed to the new value.

Possible values
Value Headers sent
public
Expires: (sometime in the future, according session.cache_expire)
Cache-Control: public, max-age=(sometime in the future, according to session.cache_expire)
Last-Modified: (the timestamp of when the session was last saved)
private_no_expire
Cache-Control: private, max-age=(session.cache_expire in the future), pre-check=(session.cache_expire in the future)
Last-Modified: (the timestamp of when the session was last saved)
private
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: private, max-age=(session.cache_expire in the future), pre-check=(session.cache_expire in the future)
Last-Modified: (the timestamp of when the session was last saved)
nocache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache

返回值

Returns the name of the current cache limiter.

更新日志

版本 说明
4.2.0 The private_no_expire cache limiter was added.

范例

Example #1 session_cache_limiter() example

<?php



session_cache_limiter('private');
$cache_limiter session_cache_limiter();

echo 
"The cache limiter is now set to $cache_limiter<br />";
?>

参见

  • session.cache_limiter

  • session_cache_expire
  • session_cache_limiter
  • session_commit
  • session_decode
  • session_destroy
  • session_encode
  • session_get_cookie_params
  • session_id
  • session_is_registered
  • session_module_name
  • session_name
  • session_regenerate_id
  • session_register
  • session_save_path
  • session_set_cookie_params
  • session_set_save_handler
  • session_start
  • session_status
  • session_unregister
  • session_unset
  • session_write_close
  • PHP MySQL HTML CSS JavaScript MSSQL AJAX .NET JSP Linux Mac ASP 服务器 SQL jQuery C# C++ java Android IOS oracle MongoDB SQLite wamp 交通频道