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

How should session and redis cooperate?

WBOY
Release: 2016-07-06 13:52:46
Original
930 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template