短信

驱动类型

驱动 描述
Alidayu 阿里大于短信服务
Aliyun 阿里云短信服务
Baidu 百度云短信服务(暂无企业账户,未测试)
Qcloud 腾讯云短信服务
Yuntongxun 容联云通讯短信服务

配置示例

return [
'alidayu' => [
'driver' => 'alidayu',
'acckey' => 'your_acckey',
'seckey' => 'your_seckey',
'signname' => '大鱼测试',
'template' => [
'register' => 'service_template_id'
],
],
'aliyun' => [
'driver' => 'aliyun',
'acckey' => 'your_acckey',
'seckey' => 'your_seckey',
'signname' => '短信测试',
'template' => [
'register' => 'service_template_id'
],
],
'baidu' => [
'driver' => 'baidu',
'acckey' => 'your_acckey',
'seckey' => 'your_seckey',
'template' => [
'register' => 'service_template_id'
],
//(可选配置)服务域名
'host' => 'sms.bj.baidubce.com', //默认
//(可选配置)签名有效期(秒)
'expiration'=> 180 //默认
],
'qcloud' => [
'driver' => 'qcloud',
'acckey' => 'your_acckey',
'seckey' => 'your_seckey',
'signname' => '短信测试',
'template' => [
'register' => '验证码:{code},您正在进行身份验证,此短信验证码{time}分钟内有效,请勿转发他人。'
],
],
'yuntongxun' => [
'driver' => 'yuntongxun',
'appkey' => 'your_appkey',
'acckey' => 'your_acckey',
'seckey' => 'your_seckey',
'template' => [
'register' => 'service_template_id'
],
],
];

使用示例

/*
* 发送短信
* $to 接受短信手机号
* $template 短信模版id
* $data 短信内容变量
*/
$sms->send('1520000000', 'register', ['code' => rand(1000, 9999)]);