PHP code example of sanzhangshitou / redis-ide-helper
1. Go to this page and download the library: Download sanzhangshitou/redis-ide-helper library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sanzhangshitou / redis-ide-helper example snippets
/** @var \Redis $redis */
$redis = new \Redis();
$redis->connect(host: 'localhost', port: 6699);
$auth = $redis->auth('redis123456');
if (!$auth) {
exit('Redis 密码认证失败');
}
$redis->select(1);
$redis->set('key', mt_rand(100000, 999999));
$res = $redis->get('key');
var_dump($res);
bash
php --ri redis
txt
Redis Support => enabled
Redis Version => 6.1.0
Redis Sentinel Version => 1.0
Available serializers => php, json