方法一:修改 php.ini 的设置
session.save_handler = redis
session.save_path =
"tcp://127.0.0.1:6379"
配置完重启php
方式二:通过 ini_set() 函数设置
ini_set
(
"session.save_handler"
,
"redis"
);
ini_set
(
"session.save_path"
,
"tcp://127.0.0.1:6379"
);
如果redis有设置过密码:
session.save_handler = redis
session.save_path =
"tcp://r-uf61ddb2722d8874.redis.rds.aliyuncs.com?auth=b4b2EE050A504542B5D1"