AMQPConnection::__construct
(PECL amqp >= Unknown)
AMQPConnection::__construct — Create an instance of AMQPConnection
Beschreibung
$credentials = array()
] )Creates an AMQPConnection instance representing a connection to an AMQP broker.
Parameter-Liste
-
credentials -
The
credentialsis an optional array of credential information for connecting to the AMQP broker.Supported indexes key Description Default value host The host to connect too Hinweis: Max 1024 characters
amqp.host port Port on the host amqp.port vhost The virtual host on the host Hinweis: Max 128 characters
amqp.vhost login The login name to use. Hinweis: Max 128 characters
amqp.login password Password Hinweis: Max 128 characters
amqp.password All other keys will be ignored.
Rückgabewerte
An AMQPConnection object.
Fehler/Exceptions
Throws AMQPException exception on parameter parsing failures, and option errors.
Beispiele
Beispiel #1 AMQPConnection::__construct() example
<?php
/* Create a connection using the INI values */
$connection1 = new AMQPConnection();
/* Specifying all keys */
$connection2 = new AMQPConnection(array(
'host' => 'example.host',
'vhost' => '/',
'port' => 5763,
'login' => 'user',
'password' => 'password'
));
?>
Anmerkungen
Hinweis:
A connection will not be established until AMQPConnection::connect() is called.
AMQPConnection::__construct