当前位置:网站首页>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
边栏推荐
- Improve user experience defensive programming
- Blog directory of zzq -- updated on 20210601
- CTF web practice competition
- Usage of map and foreach in JS
- [self cultivation of programmers] - Reflection on job hunting Part II
- AWD learning
- table 组件指定列合并行方法
- VSCODE 安装LATEX环境,参数配置,常见问题解决
- CVE-2015-1635(MS15-034 )遠程代碼執行漏洞複現
- Sentry搭建和使用
猜你喜欢

Sentry搭建和使用

Linux MySQL 5.6.51 community generic installation tutorial

uniapp引入本地字体

Flex Jiugongge layout

js中对于返回Promise对象的语句如何try catch

CTF three count

Apt command reports certificate error certificate verification failed: the certificate is not trusted

CVE-2015-1635(MS15-034 )远程代码执行漏洞复现

Cve-2015-1635 (ms15-034) Remote Code Execution Vulnerability recurrence

20201002 vs 2019 qt5.14 developed program packaging
随机推荐
Underlying mechanism mvcc
查询GPU时无进程运行,但是显存却被占用了
ts和js区别
SQLI-LABS通关(less6-less14)
浏览器滚动加载更多实现
ModuleNotFoundError: No module named ‘jieba. analyse‘; ‘ jieba‘ is not a package
VSCODE 安装LATEX环境,参数配置,常见问题解决
js创建一个自定义json数组
Cve-2015-1635 (ms15-034) Remote Code Execution Vulnerability recurrence
CVE-2015-1635(MS15-034 )远程代码执行漏洞复现
Sqli-labs customs clearance (less6-less14)
Selenium+msedgedriver+edge browser installation driver pit
Deployment API_ automation_ Problems encountered during test
js的防抖和节流
Latex参考文献引用失败 报错 LaTeX Warning: Citation “*****” on page y undefined on input line *
20201025 visual studio2019 qt5.14 use of signal and slot functions
Stress test modification solution
(the 100th blog) written at the end of the second year of doctor's degree -20200818
2021-07-17C#/CAD二次开发创建圆(5)
Wechat applet Foundation