I'm running PHP on Windows/IIS.
My session variables don't seem to be preserved from page-to-page.
This code…
//echos out the session variables in a nice format for inspection
echo "<p><pre>";
print_r($_SESSION);
echo "</pre></p>";
…outputs blank values, like this…
Array ( [s_firstvar] => [s_var2] => [s_third] => [s_numberfour] => [s_youget] => [s_thepoint] => [] => )
I found suggestions on a forum…
I had a similar problem recently (Win2000, IIS), and it turned out that PHP did not have write-access to whatever directory that the session data was stored in. You may want to look into this.
and
have you set session.save_path?
What's the proper use of php.ini's session.save_path? And, is that my problem?
can you post a bit more of your session code? some basics:
session_start()
) save_path
, these must be set previous to calling session_start()
. Oops. I found that I was not using the correct syntax when assigning values:
Does not work:
$_SESSION['$s_firstvar'] = 3;
Does work:
$_SESSION['s_firstvar'] = 3;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.