laravel 腾讯云短信
最编程
2024-05-07 18:22:28
...
public function tecentSms(Request $request)
{
$phone = $request->input("hiphone");
$appid = "1400617682";//SDK appid
$appkey = "75c4537ce96a78e33ab1410a287084de";//SDK appkey
$rand = rand(100000, 999999);//code
$minute = 1000;//有效时间
$tempid = 1264814;//模板id
$params = ["$rand"];
$sign = "郑自强学习和测试代码";//签名内容
try {
$sender = new SmsSingleSender($appid, $appkey);
$result = $sender->sendWithParam("86", $phone, $tempid, $params, $sign);//86为地区数字编号
$rsp = json_decode($result, true);
if ($rsp['result'] == 0) {
$rsp['code'] = '1';
$rsp['msg'] = $phone;
Cache::put($phone, $rand, $minute);//放入缓存
return $rsp;
} else {
$rsp['code'] = '0';
return $rsp;
}
} catch (\Exception $e) {
$rsp['code'] = '0';
return $rsp;
}
}
推荐阅读
-
laravel 腾讯云短信
-
腾讯云 CA
-
腾讯云投屏企业代码_腾讯云企业无线投屏_腾讯企业无线投屏
-
企业认证方面--使用微信公众号认证后显示已授权腾讯云运营公众号,这是否会影响公众号的运营?
-
企业级项目实战品达物流TMS(资料齐全)SpringCloud+SpringBoot+Vue+Mybatis-Plus+Docker19套JAVA企业级大型项目实战前后端分离/微服务/云原生/分布式/高并发/高可用/中间平台策略项目架构、百亿级项目实战、金融项目实战JAVA项目、物联网项目、项目面试实战、秒杀项目实战、租房项目实战、在线教育项目实战、权限系统实战、股票交易项目、短信平台实战、房源平台项目实战、工作流项目实战。
-
腾讯云 centos 服务器修改 /etc/hosts 以避免重启失败
-
腾讯云录音文件识别请求与结果查询
-
腾讯首位产品经理韩宇宙:云鱼--虚拟与现实嫁接的第三世界
-
在腾讯云上部署科学计算软件 Amber
-
腾讯云证书 TDCP