Home > Backend Development > PHP Tutorial > 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?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-09-11 11:34:14
Original
1201 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
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template