PHP code example of wtwei / aliyun-sms-php

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

    

wtwei / aliyun-sms-php example snippets


$sms = new \Wtwei\AliyunSMS\SmsService('[TEST_APP_ID]', '[TEST_APP_KEY]');

// 设置参数
$sms->setTemplate('[TEMPLATE_NAME]');
$sms->setParams(['code' => '我是验证码', 'product' => '我是产品']);
$sms->setSignName('我是签名');

// 发送短信
$sms->send('[PHONE_NUMBER]');