★ wanayoo — archive 1999 http://www.php.net/manual/it/function.session-name.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Sessions
Quick Reference
English version of this pageGerman version of this pageJapanese version of this pageFrench version of this pageHungarian version of this page
Sessions
* session_start
* session_destroy
* session_name
* session_module_name
* session_save_path
* session_id
* session_register
* session_unregister
* session_unset
* session_is_registered
* session_get_cookie_params
* session_set_cookie_params
* session_decode
* session_encode
Manual: session_name
View the source code for this pageSearch the site



Previous page
 session_destroy
 Updated
Sun, 06 Aug 2000
session_module_name 
Next page


session_name

(PHP4 )

session_name -- Get and/or set the current session name

Description

string session_name ([string name])

session_name() returns the name of the current session. If name is specified, the name of the current session is changed to its value.

The session name references the session id in cookies and URLs. It should contain only alphanumeric characters; it should be short and descriptive (i.e. for users with enabled cookie warnings). The session name is resetted 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).

Esempio 1. session_name() examples


<?php

# set the session name to WebsiteID

$previous_name = session_name ("WebsiteID");

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

Nota: This function was added in PHP 4.0.


User Contributed Notes: session_name


tojo@perceptive.se
05-Nov-1999 04:54
just out of curiosity, what the heck is this feature good for? isnt this the same thing as registering a variable called name or whatever?


digita1l@hotmail.com
05-Jan-2000 01:20
No, it actually is used to name your session itself... So you can differentiate between sessions (like if you vhost or something)


u8097500@cc.ncu.edu.tw
02-Mar-2000 12:02
Could I tranmit some variable with session_*?
How could I do it?

I have tried using "session_name($var)" to set a variable in the first page, and the next page I call "echo(session_name())" ~~php return "PHPSSEID"! But it work in the same page!

What's I missing?
Ñ{



dieujojo@yahoo.fr
04-Aug-2000 04:24
I have the same problem... i do not know why ??

If you have a solution please tell me... :)



 About Notes


Previous page
 session_destroy
 Updated
Sun, 06 Aug 2000
session_module_name 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.