0
0

Connection.php 547 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace common\logic;
  3. /**
  4. * Created by PhpStorm.
  5. * User: ZhangFeng
  6. * Date: 2018/1/30
  7. * Time: 11:41
  8. * Description:
  9. */
  10. use PhpAmqpLib\Connection\AMQPStreamConnection;
  11. class Connection
  12. {
  13. private static $_instance = null;
  14. static $HOST = '192.168.1.183';
  15. static $PORT = 5672;
  16. static $USER = 'zhaeng';
  17. static $PASS = 'zhaeng';
  18. static function getInstance()
  19. {
  20. if (is_null(self::$_instance)) {
  21. self::$_instance = new AMQPStreamConnection(self::$HOST, self::$PORT, self::$USER, self::$PASS);
  22. }
  23. return self::$_instance;
  24. }
  25. }