请问webman调试输出的话,这样写是否合理

adminadmin
//输出信息
    $r="";

        // 1. create queue创建队列
        $request = new CreateQueueRequest($queueName);
        try
        {
            $res = $this->client->createQueue($request);
            $r.='QueueCreated! \n';
        }catch (MnsException $e)
        {
            return response("CreateQueueFailed: " . $e);
        }
        $queue = $this->client->getQueueRef($queueName);

        // 2. send message 发送消息
        $messageBody = "testaaaaaaaaaaaaaaa111";
        try
        {
            $res = $queue->sendMessage($request);
            $r.="MessageSent! \n";
        }catch (MnsException $e)
        {
            return response("SendMessage Failed: " . $e);
        }

//统一输出
 return response($r);
900 0 0
0个回答

年代过于久远,无法发表回答
×
🔝