PHP code example of swallsky / alisms

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

    

swallsky / alisms example snippets


//$res = SwaSky\Alisms\Send::verifyCode('手机号',mt_rand(1000,9999),[
    'accessKeyId'   =>  '', //阿里云 acess key
    'accessKeySecret'  => '', //阿里云 access secret
    'signName'  =>  '', //短信签名
    'templateCode'  =>  '', //短信模板code
    'logfile'   =>  '' //短信异常信息日志文件信息
]);
if($res==0){
    echo '发送失败!';
}else{
    echo '发送成功!';
}
send.php
//waSky\Alisms\Send::verifyCode('手机号',mt_rand(1000,9999));
if($res==0){
    echo '发送失败!';
}else{
    echo '发送成功!';
}
send.php
//ky\Alisms\Sms;

$res = Sms::send(
    '手机号码', //接收者手机号
    [//发送的数据
        'cname'     =>  '公司名称',
        'password'  =>  mt_rand(100,999)
    ],
    'SMS_112780100' //短信模板 => 模版CODE
);

if($res==0){
    echo '发送失败!';
}else{
    echo '发送成功!';
}