Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $redis['redis'] = array(
- 'host' => '192.168.41.33',
- 'auth' => '8GLjx3tdi',
- 'port' => 6379,
- 'db' => 2
- );
- redisConn($redis['redis']);
- function redisConn($c)
- {
- $redis = new Redis();
- $result = $redis->connect($c['host'], $c['port']);
- if (empty($result)) {
- die("connect redis error");
- }
- if (!empty($c['auth'])) {
- $redis->auth($c['auth']); // 设置密码
- }
- $redis->select($c['db']);
- return $redis;
- }
Add Comment
Please, Sign In to add comment