Redis.php 790 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Http\helper;
  3. use phpDocumentor\Reflection\Types\Self_;
  4. class Redis
  5. {
  6. // 捕鱼控制
  7. protected $host = '8.129.91.11';
  8. protected $port = '16973';
  9. protected $password = '0949jfi959t*fbf0o';
  10. protected $redis;
  11. protected static $instance;
  12. public static function getInstance()
  13. {
  14. if (!self::$instance instanceof self) {
  15. return self::$instance = new self();
  16. }
  17. return self::$instance;
  18. }
  19. public function redis_content()
  20. {
  21. $this->redis = new \Redis();
  22. $this->redis->connect($this->host, $this->port);
  23. $this->redis->auth($this->password);
  24. return $this->redis;
  25. }
  26. private function __construct()
  27. {
  28. }
  29. private function __clone()
  30. {
  31. }
  32. }