PHP 8.1.28 Released!

Stomp::getSessionId

stomp_get_session_id

(PECL stomp >= 0.1.0)

Stomp::getSessionId -- stomp_get_session_idGets the current stomp session ID

Descrizione

Stile orientato agli oggetti (method):

public Stomp::getSessionId(): string|false

Stile procedurale:

stomp_get_session_id(resource $link): string|false

Gets the current stomp session ID.

Elenco dei parametri

link

Solo stile procedurale: l'identificatore di connessione stomp restituito da stomp_connect().

Valori restituiti

string session id on success o false in caso di fallimento.

Esempi

Example #1 Stile orientato agli oggetti

<?php

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

var_dump($stomp->getSessionId());

/* close connection */
unset($stomp);

?>

Il precedente esempio visualizzerà qualcosa simile a:

string(35) "ID:php.net-52873-1257291895530-4:14"

Example #2 Stile procedurale

<?php

/* connection */
$link = stomp_connect('ssl://localhost:61612');

/* check connection */
if (!$link) {
die(
'Connection failed: ' . stomp_connect_error());
}

var_dump(stomp_get_session_id($link));

/* close connection */
stomp_close($link);

?>

Il precedente esempio visualizzerà qualcosa simile a:

string(35) "ID:php.net-52873-1257291895530-4:14"

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top