时间:2021-07-01 10:21:17 帮助过:35人阅读
这是代码
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函数后:(结果就不一样了)