Guest User

Untitled

a guest
Dec 19th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. $redis['redis'] = array(
  2. 'host' => '192.168.41.33',
  3. 'auth' => '8GLjx3tdi',
  4. 'port' => 6379,
  5. 'db' => 2
  6. );
  7. redisConn($redis['redis']);
  8. function redisConn($c)
  9. {
  10. $redis = new Redis();
  11. $result = $redis->connect($c['host'], $c['port']);
  12. if (empty($result)) {
  13. die("connect redis error");
  14. }
  15. if (!empty($c['auth'])) {
  16. $redis->auth($c['auth']); // 设置密码
  17. }
  18. $redis->select($c['db']);
  19. return $redis;
  20. }
Add Comment
Please, Sign In to add comment