当前位置:网站首页>php中生成随机的6位邀请码
php中生成随机的6位邀请码
2022-07-02 06:23:00 【夜空の雪風】
前言
在系统开发的过程中有时候需要在用户注册的时候输入邀请码,这里分享一种快速生成邀请码的方法。
/** * 生成邀请码 * @param unitCode */
function create_invite_code($unitCode, $len = 3)
{
$arr = ["1", "2", "3", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
$arrLen = count($arr) - 1;
for ($i = 0; $i < $len; $i++) {
$unitCode .= $arr[mt_rand(0, $arrLen)];
}
return $unitCode;
}
例如:ANC39K
边栏推荐
- Fe - use of weex development weex UI components and configuration use
- [daily question] - Huawei machine test 01
- UEditor . Net version arbitrary file upload vulnerability recurrence
- Explanation and application of annotation and reflection
- Code execution sequence with and without resolve in promise
- JS countdown case
- PXC high availability cluster summary
- js创建一个自定义json数组
- Selenium+msedgedriver+edge browser installation driver pit
- Pytest (3) parameterize
猜你喜欢
Sqli-labs customs clearance (less6-less14)
apt命令报证书错误 Certificate verification failed: The certificate is NOT trusted
SQLI-LABS通关(less1)
微信小程序基础
How to try catch statements that return promise objects in JS
ZZQ的博客目录--更新于20210601
CVE-2015-1635(MS15-034 )遠程代碼執行漏洞複現
UEditor .Net版本任意文件上传漏洞复现
Sqli-labs customs clearance (less18-less20)
In depth study of JVM bottom layer (II): hotspot virtual machine object
随机推荐
QQ email cannot receive the email sent by Jenkins using email extension after construction (timestamp or auth...)
Error "list" object is not callable in Web automatic switching window
SQLI-LABS通关(less6-less14)
[literature reading and thought notes 13] unprocessing images for learned raw denoising
js删除字符串的最后一位
table 组件指定列合并行方法
Latex参考文献引用失败 报错 LaTeX Warning: Citation “*****” on page y undefined on input line *
Browser scrolling for more implementations
JS countdown case
[daily question] - Huawei machine test 01
由于不正常断电导致的unexpected inconsistency;RUN fsck MANUALLY问题已解决
Linux MySQL 5.6.51 community generic installation tutorial
CAD二次开发 对象
工具种草福利帖
apt命令报证书错误 Certificate verification failed: The certificate is NOT trusted
UEditor . Net version arbitrary file upload vulnerability recurrence
js判断对象是否为空
sqli-labs通关汇总-page2
sprintf_ How to use s
Common function writing method and set get writing method for calculating attributes