当前位置:网站首页>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);}边栏推荐
猜你喜欢
随机推荐
待完善:tf.name_scope() 和 tf.variable_scope()的区别
JSDay1-两数之和
二叉树 层次遍历 及例题
机器学习建模高级用法!构建企业级AI建模流水线
MySQL query problem?
每日一R「01」跟着大佬学 Rust
flutter 基本类写法
Alipay To Financial Ranking Name Modification
【PP-YOLOv2】训练自定义的数据集
【CUDA】版本自由切换
动态主机配置协议DHCP(DHCPv4)
LeetCode:最长有效括号
第二课:概率论
PHP regular to img SRC to add the domain name
Python object-oriented
有了国产 DevOps 工具 ,还怕数字化转型成本高?
A preliminary study on the use of ndk and JNI
win10电脑安装Photoshop cs7软件版本
如何搭建一套自己公司的知识共享平台
sess.restore() 和 tf.import_meta_graph() 在使用时的一些关联









