摘要:首先安裝接著看官網文檔示例阿里信息發送類發送短信驗證碼
首先安裝
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);
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/31721.html
閱讀 3222·2021-09-09 11:39
閱讀 1228·2021-09-09 09:33
閱讀 1127·2019-08-30 15:43
閱讀 546·2019-08-29 14:08
閱讀 1733·2019-08-26 13:49
閱讀 2376·2019-08-26 10:09
閱讀 1545·2019-08-23 17:13
閱讀 2283·2019-08-23 12:57