Home > Backend Development > PHP Tutorial > 关于session数据类型的问题

关于session数据类型的问题

WBOY
Release: 2016-06-23 13:40:09
Original
868 people have browsed it

$_SESSION['BACKDOOR']['name'] = 'a';$_SESSION['BACKDOOR']['name'] = array('a' => 'no', 'b' => 'yes');   //Notice: Array to string conversionprint_r($_SESSION['BACKDOOR']['name']);     //还是输出a,证明第二次赋值没成功。
Copy after login


为什么?有什么方法可以修改session的数据类型吗?


回复讨论(解决方案)

... 我的第二次赋值成功了。。。。

$_SESSION['BACKDOOR']['name'] = 'a';$_SESSION['BACKDOOR']['name'] = array('a' => 'no', 'b' => 'yes'); print_r($_SESSION['BACKDOOR']['name']); 
Copy after login
Array(    [a] => no    [b] => yes)
Copy after login
没有问题!
你的 php 的版本是多少?

此问题其实是不存在的,是我其他地方搞错了。感谢楼上的2位!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template