参考 github
https://github.com/php-amqplib/php-amqplib
参考博客
https://www.cnblogs.com/fish-minuet/p/9771096.html
public function test()
{
$conf = [
'host' => config('api.MQCONFIG.host'),
'port' => config('api.MQCONFIG.port'),
'user' => config('api.MQCONFIG.username'),
'pwd' => config('api.MQCONFIG.password'),
'vhost' => '/',
];
$exchangeName = 'kd_sms_send_ex';
$queueName = 'kd_sms_send_q';
$routingKey = 'sms_send';
$conn = new AMQPStreamConnection(
$conf['host'], $conf['port'], $conf['user'], $conf['pwd'], $conf['vhost']
);
$channel = $conn->channel();
$channel->exchange_declare($exchangeName, 'direct', false, true, false);
$channel->queue_declare($queueName, false, true, false, false);
$channel->queue_bind($queueNa