我把session存入数据库后,读取所有会话信息的时候,出现了一个问题?
程序员文章站
2022-05-19 10:33:19
...
这是代码
function get() {
session_start();
$data = $this->db->fetchAll("SELECT * FROM session");
foreach ($data as $key => &$value) {
$need = stripcslashes($value['session_data']);
session_decode($need);
$value['session_data'] = $_SESSION;
}
var_dump($data);
}
private function copyArr($arr) {
$copyArr = [];
foreach ($arr as $key => $value) {
$copyArr[$key] = $value;
}
return $copyArr;
}
我调用了copyArr函数后:(结果就不一样了)
回复内容:
这是代码
function get() {
session_start();
$data = $this->db->fetchAll("SELECT * FROM session");
foreach ($data as $key => &$value) {
$need = stripcslashes($value['session_data']);
session_decode($need);
$value['session_data'] = $_SESSION;
}
var_dump($data);
}
private function copyArr($arr) {
$copyArr = [];
foreach ($arr as $key => $value) {
$copyArr[$key] = $value;
}
return $copyArr;
}
我调用了copyArr函数后:(结果就不一样了)
上一篇: Photoshop制作剔透的蓝色放大镜
下一篇: 创建与使用函数定义与用法汇总