Re: RES: [PHP] Very simple session question
| From: | Chris | Date: | Tue, 27 May 2008 06:04:36 +0000 |
| Subject: | Re: RES: [PHP] Very simple session question | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-274718@lists.php.net to get a copy of this message | ||
Ted Wood wrote:
>
> Using double-quotes instead of single-quotes in the code you provided
> should be *no* difference at all. I'm curious if there's something else
> going on for you. Can you provide more complete code?
>
> Back to your original example, calling session_start() will restart a
> session, so only call that function once during a request, or make sure
> to write out the session using session_write() before calling it again.
Where did you hear that?
$ cat go.php
<?php
session_start();
echo 'sess id is ' . session_id() . "\n";
$_SESSION['abc'] = '12345';
print_r($_SESSION);
session_start();
echo 'sess id is ' . session_id() . "\n";
print_r($_SESSION);
$ php go.php
sess id is de0474e8080c0143b92ddb426c2c580d
Array
(
[abc] => 12345
)
sess id is de0474e8080c0143b92ddb426c2c580d
Array
(
[abc] => 12345
)
(Of course you'll get a different session id but nothing else will change).
--
Postgresql & php tutorials
http://www.designmagick.com/