阿里云新版短信服务怎么用 求救

浏览:3571 发布日期:2019/03/06 分类:求助交流 关键字: 阿里云短信服务
官方下载下来的sdk 文档中没有目录结构,哪位大神用过了麻烦提供一下帮助<?php
use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Exception\ServerException;

// Download:https://github.com/aliyun/openapi-sdk-php-client
// Usage:https://github.com/aliyun/openapi-sdk-php-client/blob/master/README-CN.md

AlibabaCloud::accessKeyClient('<accessKeyId>', '<accessSecret>')
                        ->regionId('cn-hangzhou')
                        ->asGlobalClient();

try {
    $result = AlibabaCloud::rpcRequest()
                          ->product('Dysmsapi')
                          // ->scheme('https') // https | http
                          ->version('2017-05-25')
                          ->action('SendSms')
                          ->method('POST')
                          ->options([
                                        'query' => [
                                          'RegionId' => 'cn-hangzhou',
                                          'PhoneNumbers' => '1358888888',
                                          'SignName' => 'name',
                                          'TemplateCode' => 'code',
                                          'TemplateParam' => '{[],[]}',
                                          'SmsUpExtendCode' => 'xxx',
                                          'OutId' => 'xxx',
                                        ],
                                    ])
                          ->request();
    print_r($result->toArray());
} catch (ClientException $e) {
    echo $e->getErrorMessage() . PHP_EOL;
} catch (ServerException $e) {
    echo $e->getErrorMessage() . PHP_EOL;
}
最佳答案
评论( 相关
后面还有条评论,点击查看>>