我确定我的问题确实来自于不了解一个非常基本的机制,但是我已经花费了数小时,并且仍然无法解决问题。
我制作了两个测试文件: test1.php:
//as you can see I did some research, yet it looks that my session save path is fine, so this is not the case
if (is_writable(session_save_path()))
echo 'ok <br />';
$_SESSION['test'] = '!!!single!!!'; //this saves and stays in the $_SESSION
$_SESSION[1]['test'] = '???multi???'; //this dissapears - but why and how to prevent this?
print_r($_SESSION);
?>
结果:
ok Array([test] => !!! single !!! [1] => Array([test] => ??? multi ??? )
完全符合预期。
test2.php:
if (is_writable(session_save_path()))
echo 'ok <br />'; //just to be sure
print_r($_SESSION); //why, oh why?
?>
结果:
ok数组([test] => !!! single !!!)
我的“ [1] =>数组([test] => ??? multi ???)”不存在...但是为什么呢?超级全局$ _SESSION的设置如上所述,没有任何改变...
我的服务器确实将register_globals设置为off-可以,是这样吗?即使-我也不想那样打开它。无论如何看来似乎是错误的事情。
在此先感谢您,谢谢!