RE: [PHP] sessions -- behind the scenes??

From: Date: Tue, 22 Jan 2002 19:59:31 +0000
Subject: RE: [PHP] sessions -- behind the scenes??
Groups: php.general 
Request: Send a blank email to php-general+get-81586@lists.php.net to get a copy of this message
> -----Original Message----- > From: Mikusch, Rita [mailto:MIKUSCH@ica.bc.ca] > Sent: Tuesday, January 22, 2002 12:30 PM > To: php-general@lists.php.net > Subject: [PHP] sessions -- behind the scenes?? > > > This may be a silly question . . . where is the information > that sessions > hold actually kept? Are cookies generated? Do sessions just > simplify the > process of generating those cookies and keeping track of that > information? By default, session data is stored in a file in /tmp, but you can specify another place, like a database. PHP generates a session id, which is part of the filename of the session file. PHP passes a cookie containing the session id to the browser, so that PHP can keep track of which session file belongs to which browser request. Below is an example script along with its associated session file. Kirk <? session_start(); $a = "MickeyMantle"; $b = 7; $c = 3.14159; $d = array(7,8,9); $e = array('spot' => 'dog', 'fluffy' => 'kitty', 'mighty' => 'mouse'); $f = 0; $g = '0'; session_register('a','b','c','d','e','f','g','h'); ?> session_file:/tmp/sess_37c7968b6da03aadb9e5449428a67a2d ------------- a|s:12:"MickeyMantle";b|i:7;c|d:3.14159;d|a:3:{i:0;i:7;i:1;i:8;i:2;i:9;}e|a: 3:{s :4:"spot";s:3:"dog";s:6:"fluffy";s:5:"kitty";s:6:"mighty";s:5:"mouse";}f|i:0 ;g|s :1:"0";!h|

« previous php.general (#81586) next »