AMQPConnection
PHP 手册

AMQPConnection::connect

(PECL amqp >= Unknown)

AMQPConnection::connectEstablish a connection with the AMQP broker.

说明

public bool AMQPConnection::connect ( void )

This method will initiate a connection with the AMQP broker.

参数

此函数没有参数。

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

Example #1 AMQPConnection::connect() example

<?php

/* Create a new connection */
$cnn = new AMQPConnection();

// set the login details
$cnn->setLogin('mylogin');
$cnn->setPassword('mypass');

if (
$cnn->connect()) {
    echo 
"Established a connection to the broker";
}
else {
    echo 
"Cannot connect to the broker";
}


?>


AMQPConnection
PHP 手册