세션 처리 session_cache_limiter

(PHP 4 >= 4.0.3, PHP 5, PHP 7, PHP 8)

session_cache_limiter — 현재 캐시 리미터 가져오기 및/또는 설정


설명

session_cache_limiter(?string $value = null): string|false

session_cache_limiter()는 현재 캐시 리미터의 이름을 반환합니다.

캐시 제한기는 클라이언트에 보낼 캐시 제어 HTTP 헤더를 정의합니다. 이러한 헤더는 클라이언트 및 중간 프록시에서 페이지 콘텐츠를 캐시할 수 있는 규칙을 결정합니다. 캐시 제한기를 nocache로 설정하면 클라이언트/프록시 캐싱이 허용되지 않습니다. public 값은 프록시와 클라이언트에 의한 캐싱을 허용하는 반면 private 값은 프록시에 의한 캐싱을 허용하지 않고 클라이언트가 콘텐츠를 캐시하도록 허용합니다.

private 모드에서 클라이언트로 전송된 Expire 헤더는 Mozilla를 포함한 일부 브라우저에서 혼동을 일으킬 수 있습니다. private_no_expire 모드를 사용하면 이 문제를 피할 수 있습니다. 이 모드에서는 Expire 헤더가 클라이언트에 전송되지 않습니다.

캐시 제한기를 ''로 설정하면 캐시 헤더의 자동 전송이 완전히 꺼집니다.

캐시 리미터는 요청 시작 시 session.cache_limiter에 저장된 기본값으로 재설정됩니다. 따라서 모든 요청에 ​​대해 (그리고 session_start()가 호출되기 전에) session_cache_limiter()를 호출해야 합니다.


매개변수

value
value이 지정되고 null이 아닌 경우 현재 캐시 제한기의 이름이 새 값으로 변경됩니다.

가능한 값

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

반환 값

현재 캐시 리미터의 이름을 반환합니다. 값 변경에 실패하면 false가 반환됩니다.


변경 로그

버전 설명
8.0.0 value은 이제 nullable입니다.

Examples

예제 #1 session_cache_limiter() 예제

                  
<?php

/* set the cache limiter to 'private' */

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

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

기타