phpstudy所有软件,已经通过360安全检测认证,phpstudy linux web面板(docker),已发布安全检测与修复

session_name

  • 36

session_name

(PHP 4, PHP 5)

session_nameGet and/or set the current session name

说明

string session_name ([ string $name ] )

session_name() returns the name of the current session. If name is given, session_name() will update the session name and return the old session name.

The session name is reset to the default value stored in session.name at request startup time. Thus, you need to call session_name() for every request (and before session_start() or session_register() are called).

参数

name

The session name references the name of the session, which is used in cookies and URLs (e.g. PHPSESSID). It should contain only alphanumeric characters; it should be short and descriptive (i.e. for users with enabled cookie warnings). If name is specified, the name of the current session is changed to its value.

Warning

The session name can't consist of digits only, at least one letter must be present. Otherwise a new session id is generated every time.

返回值

Returns the name of the current session.

范例

Example #1 session_name() example

<?php



$previous_name session_name("WebsiteID");

echo 
"The previous session name was $previous_name<br />";
?>

参见

  • The session.name configuration directive

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

    微信扫码登陆

    打开 微信
    扫一扫登录