Home > Backend Development > PHP Tutorial > How should session and redis cooperate?

How should session and redis cooperate?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-06 13:52:46
Original
944 people have browsed it

<code>   session("phone","$PhoneNumber");
        session("yanzhengma","$num");

        S(session_id(),$_SESSION);</code>
Copy after login
Copy after login

Is that so?
How to get it

Reply content:

<code>   session("phone","$PhoneNumber");
        session("yanzhengma","$num");

        S(session_id(),$_SESSION);</code>
Copy after login
Copy after login

Is that so?
How to get it

In the session configuration section of php.ini, directly set session.save_handler = redis (pseudo setting), modify the corresponding configuration, and then use the session normally

You can take a look
https://segmentfault.com/q/1010000002419571

Two commonly used solutions

  1. Use php’s redis extension
    https://github.com/phpredis/phpredis

  2. Use PHP native predis
    https://github.com/nrk/predis/wiki

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