Operating prerequisites
Windows must have the redis service installed and enabled.
If not, please click to view
Summary
In total, we have to do four steps
first step
Check out phpconf() for yourself.
second step
There are two files to download
igbinary,
click to download
Download the corresponding version
and put the two red files in the compressed file into the php ext directory.
third step
Download the phpredis extension
Click
Download to download the corresponding version, x86 or x64
Also put the two files in the php ext directory
third step
Add two lines to php.ini:
extension=php_igbinary.dll
extension=php_redis.dll
Then check whether the redis extension is included in phpinfo.
If it is extended, it can be used directly as a new object.
//实例化redis
$redis = new Redis();
//连接
$redis->connect('127.0.0.1', 6379);
//检测是否连接成功
echo "Server is running: " . $redis->ping();
// 输出结果 Server is running: +PONG