PHP code example of guoguo882010 / aliyun-sms

1. Go to this page and download the library: Download guoguo882010/aliyun-sms library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

guoguo882010 / aliyun-sms example snippets


$config = [
            'accessKeyId'     => 'xxxxxxx',
            'accessKeySecret' => 'dddddd',
            'signName'        => '短信签名',
        ];

$sms = new \RSHDSDK\ALiYunSMS\ALiYunSMS($config);

//手机号
$tel = '13333333333';

//阿里云短信模版id
$smsId = 'SMS_411111';

//如果短信没有参数,可以不传
$param = [
    'name' => '名字',
    'age' => '12'
];

//发送短信
$sms->send($tel,$smsId,$param);