函数名:Stomp::__construct()
适用版本:PHP 5, PHP 7
函数描述:Stomp::__construct() 是 Stomp 类的构造函数,用于创建一个 Stomp 对象并建立与消息代理的连接。
用法:
public Stomp::__construct ([ string $broker = ini_get("stomp.default_broker_uri") [, string $username = "" [, string $password = "" [, array $headers = array() ]]]] )
参数:
stomp.default_broker_uri
值。示例:
// 创建一个 Stomp 对象并连接到消息代理
$stomp = new Stomp('tcp://localhost:61613');
// 创建一个 Stomp 对象并连接到消息代理,使用用户名和密码进行验证
$stomp = new Stomp('tcp://localhost:61613', 'username', 'password');
// 创建一个 Stomp 对象并连接到消息代理,发送附加的头信息
$headers = array('header1' => 'value1', 'header2' => 'value2');
$stomp = new Stomp('tcp://localhost:61613', '', '', $headers);
注意事项: