thinkphp5使用composer安装实现阿里大鱼短信发送
淘建站为您提供更多_Ajax_thinkphp_发送,在此特别感谢您对我们的支持与厚爱!
github: http://github.com/anerg2046/alidayu 安装:
composer require anerg2046/alidayu 配置文件相关配置
<?php
return [
'alidayu' =>[
'app_key'=>'',
'app_secret'=>'',
'signature'=>'',//你的短信签名
]
];
复制代码
典型用法:
<?php
namespace app\common\service;
use anerg\Alidayu\SmsGateWay;
class Sms {
public function send_code($mobile) {
$code = mt_rand(1000, 9999);
$AliSMS = new SmsGateWay();
//send方法三个参数分别为:手机号,变量参数,模板编号
$AliSMS->send($mobile, ['code'=>$code], 'SMS_10210103');
}
}

