PHP code example of ykwang110521 / predis
1. Go to this page and download the library: Download ykwang110521/predis 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/ */
ykwang110521 / predis example snippets
use Ykwang\Predis;
$config['host'] = '127.0.0.1';
$config['port'] = 6379;
$config['prefix'] = 'wrLI_'; // 可以设置为空
$config['auth'] = ''; // 本地默认密码为空
$redis = new Predis($config);
$rand = rand(1,99);
$redis->set('key'.$rand, 'value'.$rand.'--23432423423');
$res = $redis->get('key'.$rand);
var_dump($res);die;