host, $this->port, $this->user, $this->pass, $this->vhost ); return $conn;//->channel()->queue_declare(); } /** * [php拓展自带的连接] * @author: libingke * @return \AMQPConnection */ public function AMQPConnection() { $config = [ 'host' => $this->host, 'port' => $this->port, 'login'=> $this->user, 'password' => $this->pass, 'vhost' => $this->vhost ]; $conn = new \AMQPConnection($config); if (!$conn->connect()) throw new Exception(2000); return $conn; } /** * @param string $key * @return mixed */ public function getConfig($key = '') { return is_string($key) && $key && isset($this->$key) ? $this->$key : json_decode(json_encode($this), true); } }