VPS小组

Redis测试PHP代码

给自己留个坑,免得下次需要时找不到

< ? php

$redis = new Redis();

//Connecting to Redis
$redis->connect('127.0.0.1', 6379);
$redis->auth('mypassword');
//comment out above if no auth
$res = $redis->ping();
echo $res;

127.0.0.1 -> tls://127.0.0.1 如果需要用tls连接。

命令行

redis-cli -h 127.0.0.1 -p 6379 -a ‘thisizmy!PASS’

或者

test

退出移动版