1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace common\logic\Amqp;
- /**
- * 连接配置
- * Class Config
- * @package common\logic\message
- * @author libingke
- */
- class Connect
- {
- CONST HOST = "127.0.0.1";
- CONST PORT = 5672;
- CONST USER = "guest";
- CONST PASS = "Guest";
- private static $_conn = null;
- private function __construct(){}
- private function __clone(){}
- public static function connect()
- {
- if (self::$_conn == null) {
- self::$_conn = new \PhpAmqpLib\Connection\AMQPStreamConnection(
- self::HOST,
- self::PORT,
- self::USER,
- self::PASS
- );
- }
- return self::$_conn;
- }
- }
|