使用 easysms 发送短信,提示 All the gateways have failed?
我用的aliyun,配置好参数后,测试,返回的错误是All the gateways have failed.
部分代码如下(模板我擦掉了)
阿里云确定是可用的
try{
$result = $easySms->send($phone, [
'template' => 'SMS_######',
'data' => [
'code' => $code
],
],['aliyun']);
}catch (\GuzzleHttp\Exception\ClientException $exception){
$response = $exception->getResponse();
$result = json_decode($response->getBody()->getContents(), true);
return $this->response->errorInternal($result['msg']??'短信发送异常');
}
推荐文章: