英[neɪm] 美[nem]

n. Name; reputation; someone with the name of; famous person

vt. Determine; decide; name... ;Speak the name of...

adj. Famous; Name it accordingly

php session_name() function syntax

Function:Read/set session name

Syntax: string session_name ([string $name])

Parameters :

ParameterDescription
session_nameReturns the current session name . If the name parameter is specified, the session_name() function updates the session name and returns the original session name.

Description: name The session name used in cookies or URLs, for example: PHPSESSID. Only letters and numbers can be used as the session name. It is recommended that it be as short as possible and that it is a meaningful name (for users who have enabled cookie warnings, it is easier for them to determine whether to allow this cookie). If the name parameter is specified, the current session will also use the specified value as its name.

php session_name() function example

<?php
session_start();
session_name("name");
echo session_name() ;
?>

Run instance»

Click the "Run instance" button to view the online instance

Output:

name


<?php
session_start();
session_name("php中文网");
echo session_name() ;
?>

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

php中文网