The cache display is reset to the default value of session_cache_limiter at the beginning of the request. In this way, you need to call session_cache_limiter () for every request (before session_start ).
Set cache limit to 'private'
*/
Session_cache_limiter ('private ');
$ Cache_limiter = session_cache_limiter ();
/* Set the session expiration time to 30 seconds */
Session_cache_expire (30 );
$ Cache_expire = session_cache_expire ();
/* Initialize the session */
Session_start ();
/* Output result content */
Echo "the current session cache restriction is set to: $ cache_limiter <br/> ";
Echo "current session expiration time: $ cache_expire minutes ";
/*
Output result:
The cache limiter is now set to private
The cached session pages expire after 30 minutes
*/
// Instance 2
/* Set caceh to 'private '*/
Session_cache_limiter ('private ');
/* Return caceh limiters */
$ Cache_limiter = session_cache_limiter ();
Echo "the current session cache restriction is set to: $ cache_limiter <br/> ";
// Instance 3
$ Filename = "test. mpeg ";
$ Filepath = "test. mpeg ";
Session_start ();
/* Initialize the session */
Session_commit ();
/* Output the requested file */
Header ("content-type: audio/x-mpeg"); // or other types of files
Header ("content-disposition: attachment; filename =". $ filename );
Header ("content-length:". $ filesize );
Header ("content-transfer-encoding: binarynn ");
Header ("pragma: no-cache ");
Header ("expires: 0 ");
$ File_contents = file_get_contents ($ filepath );
Print ($ file_contents
);