After I stored the session in the database, a problem occurred when reading all session information?

WBOY
Release: 2016-09-11 11:34:14
Original
1157 people have browsed it

This is the code

<code>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;
    }
</code>
Copy after login
Copy after login

After I stored the session in the database, a problem occurred when reading all session information?
After I called the copyArr function: (The result is different)

After I stored the session in the database, a problem occurred when reading all session information?

After I stored the session in the database, a problem occurred when reading all session information?

Reply content:

This is the code

<code>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;
    }
</code>
Copy after login
Copy after login

After I stored the session in the database, a problem occurred when reading all session information?
After I called the copyArr function: (The result is different)

After I stored the session in the database, a problem occurred when reading all session information?

After I stored the session in the database, a problem occurred when reading all session information?

Related labels:
php
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