[英]How to generate an OTP and send to user in codeigniter 3
我在使用Phil Sturgeon Restful服务器( https://github.com/chriskacerguis/codeigniter-restserver )的codeigniter中有一个API项目,我需要生成OTP并将其发送给用户mobile,同时向任何注册该应用的用户发送电子邮件提交正确的OTP,则仅完成注册过程。
我认为您可以使用字符串Hepler随机进行OTP
$this->load->helper('string');
$otp = random_string('alnum', 6);
// add user info and $otp into database
// send $otp to user
// check the $otp user enter and update user status to actived
有关CI中字符串帮助程序的更多信息https://www.codeigniter.com/user_guide/helpers/string_helper.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.