PHP code example of houdunwang / aliyun

1. Go to this page and download the library: Download houdunwang/aliyun 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/ */

    

houdunwang / aliyun example snippets


\Houdunwang\Aliyun\Aliyun::config([
    /*
    |--------------------------------------------------------------------------
    | 根据服务器所在区域进行选择
    | https://help.aliyun.com/document_detail/40654.html?spm=5176.7114037.1996646101.1.OCtdEo
    */
    'regionId'  => 'cn-hangzhou',
    /*
    |--------------------------------------------------------------------------
    | 如果使用主账号访问,登陆阿里云 AccessKey 管理页面创建、查看
    | 如果使用子账号访问,请登录阿里云访问控制控制台查看
    */
    'accessId'  => '',
    /*
    |--------------------------------------------------------------------------
    | 如果使用主账号访问,登陆阿里云 AccessKey 管理页面创建、查看
    | 如果使用子账号访问,请登录阿里云访问控制控制台查看
    */
    'accessKey' => '',
]);

$data = [
	//短信签名
	'sign'     => '后盾网',
	//短信模板
	'template' => 'SMS_12840367',
	//手机号
	'mobile'   => '186xxxxxxxx',
	//模板变量
	'vars'     => ["code" => "8888", "product" => "hdphp"],
];
$res = Houdunwang\Aliyun\Aliyun::instance('Sms')->send($data);