如果第一次尝试成功,为什么这个循环会运行多次?

I also tried putting the break right outside and after the try/catch with a continue inside the catch but no luck. It appears no other exceptions get thrown other than the one there.

do {
    try {
        $result = CM::campaigns()->create(config('campaignmonitor.client_id'), array_merge($optional_params, [
            'Subject' => $campaign->subject,
            'Name' => $campaign->client_id . ' - ' . $campaign->name . ' (' . $campaign->id . ')',
            'FromName' => $campaign->from_name,
            'FromEmail' => $campaign->from_email,
            'ReplyTo' => (!is_null($campaign->reply_email) ? $campaign->reply_email : $campaign->from_email),
            'HtmlUrl' => config('campaignmonitor.emailTemplatePath') . '/' . $campaign->html_file,
            'SegmentIDs' => [$campaign->segment_id]
        ]));

        break;
    } catch (CurlException $e) {
        // Try again
        $cmCreationTries++;
    }
} while ($cmCreationTries < 3);

The following does work as expected though:

do {
    try {
        $result = CM::campaigns()->create(config('campaignmonitor.client_id'), array_merge($optional_params, [
            'Subject' => $campaign->subject,
            'Name' => $campaign->client_id . ' - ' . $campaign->name . ' (' . $campaign->id . ')',
            'FromName' => $campaign->from_name,
            'FromEmail' => $campaign->from_email,
            'ReplyTo' => (!is_null($campaign->reply_email) ? $campaign->reply_email : $campaign->from_email),
            'HtmlUrl' => config('campaignmonitor.emailTemplatePath') . '/' . $campaign->html_file,
            'SegmentIDs' => [$campaign->segment_id]
        ]));

        // Request was successful, we can end the loop.
        $cmCreationTries = 4;
    } catch (CurlException $e) {
        // Try again
        $cmCreationTries++;
    }
} while ($cmCreationTries < 3);