session_save_path
Description
The session_save_path of Session for PHP gets and/or sets the current session save path.
Syntax
session_save_path( ?string $path = null ): string|false
Parameters
path
Session data path. If specified and not null, the path to which data is saved will be changed. session_save_path() needs to be called before session_start() for that purpose.
NOTE: On some operating systems, you may want to specify a path on a filesystem that handles lots of small files efficiently. For example, on Linux, reiserfs may provide better performance than ext2fs.
Return
Returns the path of the current directory used for data storage, or false on failure.
Examples
1 · void
<? $return = session_save_path(); echo $return; ?>
/opt/alt/php83/var/lib/php/session
2 · path · previous
<? $path = "/mypath/"; $return = session_save_path($path); echo $return; ?>
/opt/alt/php83/var/lib/php/session
3 · path · current
<? $path = "/mypath/"; session_save_path($path); $return = session_save_path(); echo $return; ?>
/mypath/
Links
Related
Session
- session_abort
- session_cache_expire
- session_cache_limiter
- session_commit
- session_create_id
- session_decode
- session_destroy
- session_encode
- session_gc
- session_get_cookie_params
- session_id
- session_module_name
- session_name
- session_regenerate_id
- session_register_shutdown
- session_reset
- session_set_cookie_params
- session_set_save_handler
- session_start
- session_status
- session_unset
- session_write_close