PHP code example of lanizz / laravel-alisms

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

    

lanizz / laravel-alisms example snippets


$sms = app('alisms');
$phone = ''; //手机号
$sendDate = ''; //发送日期,格式Y-m-d
$pageSize = 10; //每页数量,默认10
$pageNo = 1; //当前页面,默认1
$results = $sms->query($phone, $sendDate, $pageSize, $pageNo);
//返回值
$results = [
	[
	'SmsStatus' => 1, //状态码
        'SmsContent' => '',//短信内容
        'ReceiverNum' => '',//手机号
        'ResultCode' => '', //结果码
        'SmsCode' => '' //模版code
	]
	...
]
 php
Lanizz\Laravel\AliSmsServiceProvider::class
 php
$sms = app('alisms');
$phone = ''; //手机号
$tplCode = ''; //模版编码,阿里云申请短信模版通过后会有
$params = []; //参数,若没有参数不传
$result = $sms->send($phone, $tplCode, $params);
//返回值
$result = [
	'ErrorCode' => '', //错误码,发生错误时有
	'ErrorMessage' => '', //错误信息,发生错误时有
	'Model' => '',  //成功才有
	'RequestId' => '' //成功有才有
]