PHP Session 数据只存储一次,不能更新!
请帮我存储会话,但无法更新会话数据:
考虑以下示例代码:
<?php
session_start();
header("Cache-control: private");
$_SESSION['counter']++;
echo $_SESSION['counter'];
session_write_close();
?>
当第一次调用会话文件 C:\Window\Temp\sess_fs3r6tfmoc2tpv9ggnv8542ib2 时,生成包含正确的数据:
counter|i:1;
并且 session_cookie 也被设置,包含相同的sessionID:fs3r6tfmoc2tpv9ggnv8542ib2
当我再次运行它时,计数器不会增加!文件 \Temp\sess_fs3r6tfmoc2tpv9ggnv8542ib2 没有得到更新。但是 sessionID 是正确的。
请帮忙,在我看来配置有问题。
I Use:
PHP Version 5.3.10
Windows 7
Microsoft-IIS/7.5
with Zend Extension 220090626
Session Setting were all default:
Session Support enabled
Registered save handlers files user
Registered serializer handlers php php_binary wddx
Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 Off Off
session.bug_compat_warn Off Off
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 5 5
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path C:\Windows\Temp C:\Windows\Temp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies On On
session.use_trans_sid 0 0