摘要:首先安装接着看官网文档示例阿里信息发送类发送短信验证码
首先安装
composer require alibabacloud/sdk接着看alibabacloud官网文档
https://packagist.org/package...
示例 My_composer_aliyunsms.php$code ]; AlibabaCloud::accessKeyClient($config["accessKeyId"], $config["accessSecret"]) ->regionId($config["regionId"]) ->asGlobalClient(); try { $result = AlibabaCloud::rpcRequest() ->product("Dysmsapi") ->version("2017-05-25") ->action("SendSms") ->method("POST") ->options([ "query" => [ "PhoneNumbers" => $phone, "SignName" => $config["SignName"], "TemplateCode" => $config["TemplateCode"], "TemplateParam" => json_encode($param) ], ]) ->request(); return $result->toArray(); } catch (ClientException $e) { echo $e->getErrorMessage() . PHP_EOL; } catch (ServerException $e) { echo $e->getErrorMessage() . PHP_EOL; } } }demo
include "My_composer_aliyunsms.php"; $sms = new My_composer_aliyunsms(); $phone="xxxxxx"; $code="99999"; $config = [ "accessKeyId" => "LTAIMje******hS", "accessSecret" => "fMuQTLUrKQN******Z2m07", "SignName" => "****", "TemplateCode" => "SMS_****04", "regionId" => "cn-hangzhou" ]; $re = $sms->sendCode($config,$phone,$code); var_dump($re);
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/31721.html
阅读 3101·2021-09-09 11:39
阅读 1213·2021-09-09 09:33
阅读 1085·2019-08-30 15:43
阅读 518·2019-08-29 14:08
阅读 1715·2019-08-26 13:49
阅读 2359·2019-08-26 10:09
阅读 1529·2019-08-23 17:13
阅读 2267·2019-08-23 12:57