函数名:StompFrame::__construct()
适用版本:PHP 5 >= 5.3.0, PHP 7
函数描述:StompFrame::__construct() 是 StompFrame 类的构造函数。它用于创建一个新的 StompFrame 对象。
用法:
StompFrame::__construct ( string $command [, array $headers = array() [, string $body = '' ]] )
参数:
$command
:必需,表示 STOMP 帧的命令字符串。$headers
:可选,表示 STOMP 帧的头部信息。默认为一个空数组。$body
:可选,表示 STOMP 帧的正文内容。默认为空字符串。示例:
// 创建一个新的 StompFrame 对象
$frame = new StompFrame('SEND', array('destination' => '/queue/test'), 'Hello, World!');
// 输出 STOMP 帧的命令
echo $frame->command; // 输出:SEND
// 输出 STOMP 帧的头部信息
echo $frame->headers['destination']; // 输出:/queue/test
// 输出 STOMP 帧的正文内容
echo $frame->body; // 输出:Hello, World!
注意事项: