我使用以下代码在PHP中测试msg队列。
<?php
$mq = msg_get_queue(3141592653589793238);
while (true)
{
$msg_type = null;
$msg = null;
$max_msg_size = 32;
msg_receive($mq, 1, $msg_type, $max_msg_size, $msg);
print "receive: $msg ($msg_type)\n";
}
?>
根据手册,如果需要的类型(此处,= 1)为正,则接收的类型应与所需类型相同。但是当我运行代码时,输出如下所示。此外,它是非阻塞的,并且在之前没有发送任何内容时继续接收空消息。
receive: (0)
receive: (0)
receive: (0)
receive: (0)
receive: (0)
receive: (0)
receive: (0)
receive: (0)
receive: (0)
receive: (0)
receive: (0)
那么这里有什么问题?