当前位置:网站首页>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
边栏推荐
- 【文献阅读与想法笔记13】 Unprocessing Images for Learned Raw Denoising
- Sublime text configuring PHP compilation environment
- Implement strstr() II
- SQLI-LABS通关(less2-less5)
- Fe - use of weex development weex UI components and configuration use
- [daily question 1] write a function to judge whether a string is the string after the rotation of another string.
- Latex warning: citation "*****" on page y undefined on input line*
- 由于不正常断电导致的unexpected inconsistency;RUN fsck MANUALLY问题已解决
- 2020-9-23 use of QT timer qtimer class.
- js中对于返回Promise对象的语句如何try catch
猜你喜欢

Latex 报错 LaTeX Error: The font size command \normalsize is not defined问题解决

uniapp引入本地字体

UEditor . Net version arbitrary file upload vulnerability recurrence

Uniapp introduces local fonts

由于不正常断电导致的unexpected inconsistency;RUN fsck MANUALLY问题已解决

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

Date time API details

蚂蚁集团g6初探

如何调试微信内置浏览器应用(企业号、公众号、订阅号)

Sqli-labs customs clearance (less6-less14)
随机推荐
uniapp引入本地字体
Eggjs -typeorm treeenity practice
VSCODE 安装LATEX环境,参数配置,常见问题解决
浏览器滚动加载更多实现
UEditor .Net版本任意文件上传漏洞复现
部署api_automation_test过程中遇到的问题
Flask migrate cannot detect db String() equal length change
Pytest (1) case collection rules
Sqli labs customs clearance summary-page3
Automation - when Jenkins pipline executes the nodejs command, it prompts node: command not found
Stack (linear structure)
Win10桌面图标没有办法拖动(可以选中可以打开可以删除新建等操作但是不能拖动)
Promise中有resolve和无resolve的代码执行顺序
sqli-labs通关汇总-page2
Stress test modification solution
Browser scrolling for more implementations
In depth study of JVM bottom layer (V): class loading mechanism
Code execution sequence with and without resolve in promise
SQLI-LABS通关(less18-less20)
js判断数组中对象是否存在某个值