session_reset
(PHP 5 >= 5.6.0, PHP 7)
session_reset — Re-initialize session array with original values
Описание
void session_reset
( void
)
session_reset() reinitializes a session with original values stored in session storage. This function requires an active session and discards changes in $_SESSION.
Возвращаемые значения
Эта функция не возвращает значения после выполнения.
Смотрите также
- $_SESSION
- The session.auto_start configuration directive
- session_start() - Start new or resume existing session
- session_abort() - Discard session array changes and finish session
- session_commit() - Псевдоним session_write_close
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для работы с сессиями
- Управление сессиями
- 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_is_registered
- session_module_name
- session_name
- session_regenerate_id
- session_register_shutdown
- session_register
- session_reset
- session_save_path
- session_set_cookie_params
- session_set_save_handler
- session_start
- session_status
- session_unregister
- session_unset
- session_write_close
Коментарии
First of all you should execute this code :
<?php
session_start();
$_SESSION["A"] = "Some Value";
?>
then you should execute this one :
<?php
start_session();
$_SESSION["A"] = "Some New Value"; // set new value
session_reset(); // old session value restored
echo $_SESSION["A"];
//Output: Some Value
?>
That is because session_reset() is rolling back changes to the last saved session data, which is their values right after the session_start().