PHP code example of hongyukeji / yii2-sms

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

    

hongyukeji / yii2-sms example snippets


return [
    'components' => [
    
        // 

$result = Yii::$app->sms->send(
    'verificationCode',
    '13800138000',
    ['code' => '123456', 'product' => 'name']
);

if ($result['code'] == '0') {
    echo '发送成功';
} else {
    echo '发送失败: ' . $result['message'];
}

// 手机号为数组格式,可以批量发送短信,如:['13800138000','13900139000']
// 返回格式: ['code'=>'...','message'=>'...']
// code返回码说明: 0-发送成功, 1-发送失败