当前位置:网站首页>Tp5 in cache cache, storage cell phone text message authentication code
Tp5 in cache cache, storage cell phone text message authentication code
2022-08-08 23:06:00 【Also believe that light?】
Set the mobile phone SMS verification code cache method:
/*** Set up mobile phone SMS verification code cache* #User: JW* #Email:[email protected]* #Date:* @param $data_cache*/public function setRegSmsCache($data_cache){Cache::set('sms_' . $data_cache['mobile'], $data_cache, 300);}
Move the mobile phone SMS verification code cache method
public function send_text_message()$data['time']=time()+60;//When the verification code expires, the setting here is to expire after one minute$data['mobile']='18888888888';//The mobile phone number that accepts SMS$data['code']= rand(100000,999999);//Get 6-digit SMS verification code randomly$this->setRegSmsCache($data);}
Verify the mobile phone SMS verification code cache method:
/*** Verify that the verification code is correct* @param $mobile recipient* @param $code SMS verification code* @return json*/public function checkRegSms($mobile, $code = false){if (!$mobile) return false;if ($code === false) {if (!Cache::has('sms_' . $mobile)) return true;if (Cache::get('sms_' . $mobile)['times'] > time()) {return false;} else {return true;}} else {if (!Cache::has('sms_' . $mobile)) return false;if (Cache::get('sms_' . $mobile)['code'] == $code) {return true;} else {return false;}}}
Movement verification mobile phone SMS verification code cache method
public function verification_code()$mobile='18888888888';//Mobile phone number that needs to be verified$code='100000';//Received verification code$this->checkRegSms($mobile,$code);}
边栏推荐
猜你喜欢
wps备份与恢复在哪里?
ABP中的数据过滤器
【Bug解决】ValueError: Object arrays cannot be loaded when allow_pickle=False
2022牛客多校六 M-Z-Game on grid(动态规划)
wps表格怎么调整表格大小?wps表格调整表格大小的方法
JS中的原型与原型链
2022牛客多校六 A-Array(构造+哈夫曼)
Xcode 创建一个Dylib 插件deb项目
[Bug solution] ValueError: Object arrays cannot be loaded when allow_pickle=False
JS中的作用域与作用域链
随机推荐
ALIPAY WEB log in rsa encryption analysis record
4399 it operations intern interview experience
php7.4安装ssh2扩展和使用ssh链接sftp上传下载文件
wsgw登录抓包记录
微信公众号 接口测试平台 获取自定义菜单教程
数组去重的几种方法
三国战绩 风云再起 网络版 物品序号 和 基址列表
JSDay1-两数之和
flutter 基本类写法
腾讯技术支持实习二面——腾讯爸爸的临幸就是这么突然(offer到手)
wps表格怎么调整表格大小?wps表格调整表格大小的方法
Kubernetes与OpenStack
2022牛客多校六 A-Array(构造+哈夫曼)
待完善:tf.name_scope() 和 tf.variable_scope()的区别
tp5用cache缓存,存储手机短信验证码
微信小程序项目--订单
ArcPy spot number - automatically fill according to field length
2022杭电多校六 1007-Shinobu loves trip(同余方程)
Taro小程序跨端开发入门实战
[Bug solution] ValueError: Object arrays cannot be loaded when allow_pickle=False