Php/docs/stomp.construct

提供:Dev Guides
< Php
2020年12月14日 (月) 12:32時点におけるNotes (トーク | 投稿記録)による版 (autoload)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先:案内検索

Stomp::__construct

stomp_connect

(PECL stomp >= 0.1.0)

Stomp::__construct -- stomp_connectOpens a connection


説明

オブジェクト指向型 (constructor):

public Stomp::__construct ([ string $broker = ini_get("stomp.default_broker_uri") [, string $username [, string $password [, array $headers ]]]] )

手続き型:

stomp_connect ([ string $broker = ini_get("stomp.default_broker_uri") [, string $username [, string $password [, array $headers ]]]] ) : resource

Opens a connection to a stomp compliant Message Broker.


パラメータ

broker
The broker URI
username
The username.
password
The password.
headers
追加のヘッダ (例: receipt) を含む連想配列。


返り値

注意:

トランザクションヘッダを指定し、そのメッセージがトランザクションの一部であることを示します。

変更履歴

バージョン 説明
PECL stomp 1.0.1 The headers parameter was added


例1 オブジェクト指向型

<?php/* connection */try {    $stomp = new Stomp('tcp://localhost:61613');} catch(StompException $e) {    die('Connection failed: ' . $e->getMessage());}/* close connection */unset($stomp);?>

例2 手続き型

<?php/* connection */$link = stomp_connect('ssl://localhost:61612');/* check connection */if (!$link) {    die('Connection failed: ' . stomp_connect_error());}/* close connection */stomp_close($link);?>