首页 >函数列表 >session_regenerate_id

session_regenerate_id

session_regenerate_id

(PHP 4 >= 4.3.2, PHP 5)

session_regenerate_id Update the current session id with a newly generated one

说明

bool session_regenerate_id ([ bool $delete_old_session = false ] )

session_regenerate_id() will replace the current session id with a new one, and keep the current session information.

参数

delete_old_session

Whether to delete the old associated session file or not.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE.

更新日志

版本 说明
4.3.3 Since then, if session cookies are enabled, use of session_regenerate_id() will also submit a new session cookie with the new session id.
5.1.0 Added the delete_old_session parameter.

范例

Example #1 A session_regenerate_id() example

<?php
session_start
();

$old_sessionid session_id();

session_regenerate_id();

$new_sessionid session_id();

echo 
"Old Session: $old_sessionid<br />";
echo 
"New Session: $new_sessionid<br />";

print_r($_SESSION);
?>

参见


  • 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 交通频道